weechat-relay-helper 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a084eb52eecef49fe4839dae751a16d3b6c61fa8
4
- data.tar.gz: 35e038d5804f41476d18e58a98d88ab7c80e4267
3
+ metadata.gz: 14b5b2f53fb012a9f1da7447dd9f86a41be77727
4
+ data.tar.gz: 978be4045d94684ed77200183434767714dc1f3a
5
5
  SHA512:
6
- metadata.gz: 814a14e0c0e344b894b7d3b99e6bf0e0b5ec73b349fceb4a7204071c907f40217a187d5f84fbdbbe8e5eb4cd70a1b7d187c3829793527fc29d3b2f3ac3fce223
7
- data.tar.gz: c335af3eae27df3c84c0b469d9fc4dc459a1c320c174e3a8bd4990481571b946618e9b1b7b740227dad70ef24b960c80182f50dae717e10988bb4b087fbdcc60
6
+ metadata.gz: d9c7254f7d631b8d3c576b9742c7139608826983856b8c7d829208ceb37fc50f2ee4d38157df71525780c698080be9b11208ca5ff3a36105b3510d7b905d11ef
7
+ data.tar.gz: b7095597c40a1306bc9ea8fc863620a14ae71f3c4ee1d59dea9af335109926aea889d632460c2d1cf22f6302ebcbd6958e0cc8e08a317d195ab283b3bb5d6106
@@ -8,12 +8,12 @@ opts = RelayHelper::Options.new ARGV
8
8
  conn = RelayHelper::Weechat.new opts.host, opts.port, opts.ssl, opts.compression, opts.password
9
9
 
10
10
  Thread.new do
11
- loop do #until conn.connection.closed?
11
+ until conn.closed?
12
12
  begin
13
- r, _, _ = IO.select [conn.connection.socket]
13
+ r, _, _ = IO.select [conn.socket]
14
14
  unless r.empty?
15
- len = conn.connection.read(4)
16
- rest = conn.connection.read(len.unpack('L>')[0] - 4)
15
+ len = conn.read(4)
16
+ rest = conn.read(len.unpack('L>')[0] - 4)
17
17
  r = RelayHelper::Response.new(len + rest)
18
18
  ap({ id: r.id, data: r.data })
19
19
  end
@@ -29,6 +29,16 @@ puts "Go ahead and type your commands."
29
29
  puts "Relay reference is located at http://www.weechat.org/files/doc/devel/weechat_relay_protocol.en.html"
30
30
 
31
31
  while line = Readline.readline('', true)
32
- conn.connection.puts line
32
+ if conn.closed?
33
+ puts "The connection is closed, sending that would have no effect. Ignoring."
34
+ next
35
+ end
36
+ if line =~ /^quit/
37
+ puts "Closing the application."
38
+ conn.puts line
39
+ conn.close
40
+ exit 0
41
+ end
42
+ conn.puts line
33
43
  puts "--> #{line}"
34
44
  end
@@ -1,3 +1,3 @@
1
1
  module RelayHelper
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -7,5 +7,26 @@ module RelayHelper
7
7
  @connection.open
8
8
  @connection.puts "init#{" password=#{password}," if password}compression=#{compression ? 'zlib' : 'off'}"
9
9
  end
10
+ def close
11
+ @connection.close
12
+ end
13
+ def closed?
14
+ @connection.closed?
15
+ end
16
+ def open
17
+ @connection.open
18
+ end
19
+ def socket
20
+ @connection.socket
21
+ end
22
+ def puts line
23
+ @connection.puts line
24
+ end
25
+ def write bytes
26
+ @connection.write bytes
27
+ end
28
+ def read numbytes
29
+ @connection.read numbytes
30
+ end
10
31
  end
11
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weechat-relay-helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rylee Fowler