tkellem 0.8.9 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -92,6 +92,7 @@ module BouncerConnection
92
92
  def receive_line(line)
93
93
  failsafe("message: {#{line}}") do
94
94
  trace "from client: #{line}"
95
+ return if line.blank?
95
96
  msg = IrcMessage.parse(line)
96
97
 
97
98
  command = msg.command
@@ -40,6 +40,7 @@ module IrcServerConnection
40
40
  def receive_line(line)
41
41
  @bouncer.failsafe(:receive_line) do
42
42
  @bouncer.trace "from server: #{line}"
43
+ return if line.blank?
43
44
  msg = IrcMessage.parse(line)
44
45
  @bouncer.server_msg(msg)
45
46
  end
@@ -340,7 +340,7 @@ class TkellemBot
340
340
 
341
341
  def list
342
342
  public_networks = Network.all(:conditions => 'user_id IS NULL')
343
- user_networks = user.reload.try(:networks) || []
343
+ user_networks = user.try(:reload).try(:networks) || []
344
344
  if user_networks.present? && public_networks.present?
345
345
  r "Public networks are prefixed with [P], user-specific networks with [U]."
346
346
  end
@@ -1,3 +1,3 @@
1
1
  module Tkellem
2
- VERSION = "0.8.9"
2
+ VERSION = "0.8.10"
3
3
  end
@@ -5,16 +5,21 @@ include Tkellem
5
5
 
6
6
  describe BouncerConnection, "connect" do
7
7
  before do
8
- u = User.create(:username => 'speccer')
9
- u.password = 'test123'
10
- u.save
11
- tk = mock(TkellemServer)
8
+ @u = User.create(:username => 'speccer')
9
+ @u.password = 'test123'
10
+ @u.save
11
+ @tk = mock(TkellemServer)
12
12
  @b = mock(Bouncer)
13
- tk.should_receive(:find_bouncer).with(u, 'testhost').and_return(@b)
14
- @bc = em(BouncerConnection).new(tk, false)
13
+ @bc = em(BouncerConnection).new(@tk, false)
14
+ end
15
+
16
+ it "should ignore blank lines" do
17
+ @bc.should_receive(:error!).never
18
+ @bc.receive_line("")
15
19
  end
16
20
 
17
21
  it "should connect after receiving credentials" do
22
+ @tk.should_receive(:find_bouncer).with(@u, 'testhost').and_return(@b)
18
23
  @bc.receive_line("NICK speccer")
19
24
  @bc.receive_line("PASS test123")
20
25
  @b.should_receive(:connect_client).with(@bc)
@@ -22,6 +27,7 @@ describe BouncerConnection, "connect" do
22
27
  end
23
28
 
24
29
  it "should connect when receiving user before pass" do
30
+ @tk.should_receive(:find_bouncer).with(@u, 'testhost').and_return(@b)
25
31
  @bc.receive_line("USER speccer@testhost")
26
32
  @bc.receive_line("PASS test123")
27
33
  @b.should_receive(:connect_client).with(@bc)
@@ -47,6 +47,14 @@ describe Bouncer, "connection" do
47
47
  s.server_msg(IrcMessage.parse(":speccer!test@host ping :HAI"))
48
48
  end
49
49
 
50
+ it "should ignore blank lines" do
51
+ b = mock("bouncer", :trace => nil)
52
+ b.should_receive(:failsafe).and_yield
53
+ s = em(IrcServerConnection).new('connected', b, false)
54
+ b.should_receive(:server_msg).never
55
+ s.receive_line("")
56
+ end
57
+
50
58
  def tk_server
51
59
  $tk_server ||= TkellemServer.new
52
60
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkellem
3
3
  version: !ruby/object:Gem::Version
4
- hash: 45
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 9
10
- version: 0.8.9
9
+ - 10
10
+ version: 0.8.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Palmer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-03 00:00:00 Z
18
+ date: 2012-02-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: eventmachine
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  requirements: []
181
181
 
182
182
  rubyforge_project:
183
- rubygems_version: 1.8.10
183
+ rubygems_version: 1.8.11
184
184
  signing_key:
185
185
  specification_version: 3
186
186
  summary: IRC bouncer with multi-client support