rflow-components-irc 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b8ae275a388d2064aec32bd1b4719e90b85ddcb
4
- data.tar.gz: af5047c95d9b66976db8a30841256302ae91aea0
3
+ metadata.gz: a278a2b1cbefadcddb0b5425906e8ae62bfe1702
4
+ data.tar.gz: 3504f90b41efd1b92c9bd535086957303b5be865
5
5
  SHA512:
6
- metadata.gz: 3b501eee9dcaf1500c1a9a75630c522defa352d72da64f009ca136ed62e5b51f88c6bf26d267fa3662ba8c5e7d7189eec08196928b72c26413c86ebc365f59f6
7
- data.tar.gz: e61046b0164b4a7d10289229030093c39980aeb3850c7a762ef9cc4f1c10a0048650aa86dc4ab6f5aafa3836749b7076935aa169a0a368a89a4280c4853d3b5c
6
+ metadata.gz: 8afebdd4b908e95a83d3bb8935f6bf377f768003a40e0bc8a28a163f423a601ced2c2be7a8873545dacba6a099fe6ebf584df3671d94186bae0401e924fca662
7
+ data.tar.gz: c94e513b3cb974adf5ed6145e295d7823876cf2ed67b9a31adc6807a50f2a1c49821955dcb0673aa3134782bcc724bbe7b7176d626b46d358f5817ccdc139538
@@ -42,26 +42,27 @@ class RFlow
42
42
  def run!
43
43
  @client_connection = EM.connect(@server, @port, Connection) do |conn|
44
44
  conn.client = self
45
+ RFlow.logger.debug { "#{name}: Connection from #{@client_ip}:#{@client_port} to #{@server_ip}:#{@server_port}" }
45
46
  end
46
47
  end
47
48
 
48
49
  def process_message(input_port, input_port_key, connection, message)
49
- RFlow.logger.debug "Received a message"
50
+ RFlow.logger.debug { "#{name}: Received a message" }
50
51
  return unless message.data_type_name == 'RFlow::Message::Data::IRC::Message'
51
52
 
52
53
  if config['promiscuous']
53
- RFlow.logger.debug "Received an IRC::Message message, sending to client connection"
54
+ RFlow.logger.debug { "#{name}: Received an IRC::Message message, sending to client connection" }
54
55
  client_connection.send_irc_message message
55
56
  else
56
- RFlow.logger.debug "Received an IRC::Message message, determining if its mine"
57
+ RFlow.logger.debug { "#{name}: Received an IRC::Message message, determining if it's mine" }
57
58
  my_events = message.provenance.find_all {|event| event.component_instance_uuid == instance_uuid}
58
- RFlow.logger.debug "Found #{my_events.size} processing events from me"
59
+ RFlow.logger.debug { "#{name}: Found #{my_events.size} processing events from me" }
59
60
  # Attempt to send the data to each context match.
60
61
  # TODO: check for correctness
61
62
  my_events.each do |event|
62
- RFlow.logger.debug "Inspecting context #{client_connection.signature.to_s} == #{event.context.to_s}"
63
+ RFlow.logger.debug { "#{name}: Inspecting context #{client_connection.signature.to_s} == #{event.context.to_s}" }
63
64
  if client_connection.signature.to_s == event.context.to_s
64
- RFlow.logger.debug "Found connection for #{event.context}, sending message to associated client connection"
65
+ RFlow.logger.debug { "#{name}: Found connection for #{event.context}, sending message to associated client connection" }
65
66
  client_connection.send_irc_message message
66
67
  end
67
68
  end
@@ -77,7 +78,6 @@ class RFlow
77
78
  def post_init
78
79
  @client_port, @client_ip = Socket.unpack_sockaddr_in(get_peername) rescue ["?", "?.?.?.?"]
79
80
  @server_port, @server_ip = Socket.unpack_sockaddr_in(get_sockname) rescue ["?", "?.?.?.?"]
80
- RFlow.logger.debug "Connection from #{@client_ip}:#{@client_port} to #{@server_ip}:#{@server_port}"
81
81
  super
82
82
  end
83
83
 
@@ -85,7 +85,7 @@ class RFlow
85
85
  @reconnecting = false
86
86
  @connected = true
87
87
 
88
- RFlow.logger.info("Connected to IRC server #{client.config['server']}:#{client.config['port']}")
88
+ RFlow.logger.info "#{client.name}: Connected to IRC server #{client.config['server']}:#{client.config['port']}"
89
89
 
90
90
  command "PASS", [client.config['server_password']] unless client.config['server_password'].nil?
91
91
  command "NICK", [client.config['nickname']]
@@ -95,7 +95,7 @@ class RFlow
95
95
  end
96
96
 
97
97
  def receive_line(line)
98
- RFlow.logger.debug("IRCClient#receive_line: #{line}")
98
+ RFlow.logger.debug { "#{client.name}: IRCClient#receive_line: #{line}" }
99
99
  prefix, cmd, params = IRC.parse_irc_line(line)
100
100
 
101
101
  # Now have an optional prefix, required cmd, and optional param array
@@ -104,7 +104,7 @@ class RFlow
104
104
  command('PONG', params)
105
105
  else
106
106
  # create an IRC message here and send it along
107
- RFlow.logger.debug("Sending IRC message '#{line}', signature '#{signature.class}:#{signature}', '#{signature.to_s.class}:#{signature.to_s}'")
107
+ RFlow.logger.debug { "#{client.name}: Sending IRC message '#{line}', signature '#{signature.class}:#{signature}', '#{signature.to_s.class}:#{signature.to_s}'" }
108
108
 
109
109
  client.from_server.send_message(RFlow::Message.new('RFlow::Message::Data::IRC::Message').tap do |m|
110
110
  m.data.prefix = prefix
@@ -120,9 +120,9 @@ class RFlow
120
120
 
121
121
  def unbind(reason = nil)
122
122
  if @connected || @reconnecting
123
- RFlow.logger.error("Disconnected from IRC server #{client.config['server']}:#{client.config['port']} due to '#{reason}', reconnecting ...")
123
+ RFlow.logger.error "#{client.name}: Disconnected from IRC server #{client.config['server']}:#{client.config['port']} due to '#{reason}', reconnecting ..."
124
124
  EM.add_timer(client.config['reconnect_interval']) do
125
- RFlow.logger.error "Attempting reconnect to IRC server #{client.config['server']}:#{client.config['port']}"
125
+ RFlow.logger.error "#{client.name}: Attempting reconnect to IRC server #{client.config['server']}:#{client.config['port']}"
126
126
  reconnect(client.config['server'], client.config['port'])
127
127
  end
128
128
  @connected = false
@@ -133,17 +133,17 @@ class RFlow
133
133
  end
134
134
 
135
135
  def send_irc_message(irc_message)
136
- RFlow.logger.debug "Sending an IRC message to #{client_ip}:#{client_port}"
136
+ RFlow.logger.debug { "#{client.name}: Sending an IRC message to #{client_ip}:#{client_port}" }
137
137
  command irc_message.data.command, irc_message.data.parameters, irc_message.data.prefix
138
138
  end
139
139
 
140
140
  def send_irc_line(line)
141
- RFlow.logger.debug "Sending line '#{line}'"
141
+ RFlow.logger.debug { "#{client.name}: Sending line '#{line}'" }
142
142
  send_data "#{line}\r\n"
143
143
  end
144
144
 
145
145
  def command(cmd, args = [], prefix = nil)
146
- RFlow.logger.debug("command: '#{cmd}' with args ['#{args.join("', '")}'] and prefix '#{prefix}'")
146
+ RFlow.logger.debug { "#{client.name}: command: '#{cmd}' with args ['#{args.join("', '")}'] and prefix '#{prefix}'" }
147
147
  line = ''
148
148
  if prefix
149
149
  line << ":#{prefix} "
@@ -1,7 +1,7 @@
1
1
  class RFlow
2
2
  module Components
3
3
  module IRC
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rflow-components-irc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael L. Artz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-30 00:00:00.000000000 Z
11
+ date: 2014-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rflow