Paul Klumpp преди 12 години
родител
ревизия
285428213a
променени са 1 файла, в които са добавени 12 реда и са изтрити 15 реда
  1. 12 15
      connection.rb

+ 12 - 15
connection.rb

@@ -405,29 +405,28 @@ def main
 
 				elsif cmd == "BC_RE"
 					
-					if inputmessage =~ /^(BC_RE) (.+) (.+)=(\d+),(.+)=(\d+)$/
+					if payload =~ /^(.+) (.+)=(\d+),(.+)=(\d+)$/
 						
-						command = $1
-						bcid = $2
-						user_string = $3
-						user_count = $4
-						item_string = $5
-						item_count = $6
+						bcid = $1
+						user_string = $2
+						user_count = $3
+						item_string = $4
+						item_count = $5
 						
-						payload = "%s %s %s=%d,%s=%d" % [command, bcid, user_string, user_count, item_string, item_count]
+						payload = "%s %s=%d,%s=%d" % [bcid, user_string, user_count, item_string, item_count]
 						# according bcid it is possible to get the originating user.. so send only to his topic!
 						
 						if $broadcasts[bcid]
 							to_user = $broadcasts[bcid]
 							put_log "SYS Broadcast reply bcid: #{bcid} underway. To: '#{to_user}'."
-							send("/topic/#{to_user}-replies", payload)
+							send("/topic/#{to_user}-replies", "#{cmd} #{payload}")
 							#send_cmd(cmd, payload)  .. and thus: central_brain has to collect the BC_REs
 						else
 							put_log "SYS Broadcast reply bcid: #{bcid} underway."
-							send("/topic/broadcast", payload)
+							send("/topic/broadcast", "#{cmd} #{payload}")
 							#send_cmd(cmd, payload)  .. and thus: central_brain has to collect the BC_REs
-							
 						end
+						
 					else
 						put_log "SYS Format is BC_RE <bcid> <userstring>=<usercount>,<itemstring>=<itemcount>"
 					end
@@ -472,12 +471,10 @@ def main
 			
 		end  # of if we should process it
 		
-	end
-	# of while input != "part"
+	end 	# of while input != "part"
 	
 		
-end
-# of main
+end # of main
 
 
 main