camper_van 0.0.7 → 0.0.8

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- camper_van (0.0.7)
4
+ camper_van (0.0.8)
5
5
  eventmachine (~> 0.12.10)
6
6
  firering (~> 1.2.0)
7
7
  logging (~> 1.5.1)
data/README.md CHANGED
@@ -53,6 +53,9 @@ Connect, and `/LIST` will show you the irc channels / campfire rooms you
53
53
  have access to. To connect to more than one subdomain, make a separate
54
54
  connection for each.
55
55
 
56
+ Your campfire subdomain should be just the subdomain part. If your campfire url
57
+ is `mycompany.campfirenow.com`, your subdomain would be `mycompany`.
58
+
56
59
  ## Development
57
60
 
58
61
  CamperVan uses:
@@ -66,7 +69,7 @@ CamperVan uses:
66
69
 
67
70
  ## License
68
71
 
69
- See LICENSE for details.
72
+ MIT, See LICENSE for details.
70
73
 
71
74
  ## Contributing
72
75
 
@@ -309,7 +309,7 @@ module CamperVan
309
309
  users.delete user.id
310
310
 
311
311
  when "Paste"
312
- lines = message.body.split("\n")
312
+ lines = message.body.split(/\n|\r\n|\r/)
313
313
 
314
314
  lines[0..2].each do |line|
315
315
  client.campfire_reply :privmsg, name, channel, ":> " + line
@@ -352,7 +352,9 @@ module CamperVan
352
352
  else
353
353
  body = message.body
354
354
  end
355
- client.campfire_reply :privmsg, name, channel, ":" + body
355
+ body.split(/[\r\n]+/).each do |line|
356
+ client.campfire_reply :privmsg, name, channel, ":" + line
357
+ end
356
358
  end
357
359
 
358
360
  when "TopicChange"
@@ -366,7 +368,9 @@ module CamperVan
366
368
  end
367
369
 
368
370
  when "Tweet"
369
- client.campfire_reply :privmsg, name, channel, message.body
371
+ message.body.split(/\n|\r\n|\r/).each do |line|
372
+ client.campfire_reply :privmsg, name, channel, line
373
+ end
370
374
 
371
375
  else
372
376
  logger.warn "unknown message #{message.type}: #{message.body}"
@@ -95,6 +95,8 @@ module CamperVan
95
95
  shutdown
96
96
  else
97
97
  @subdomain, @api_key = *args.first.split(":")
98
+ # ignore full "mycompany.campfirenow.com" being set as the subdomain
99
+ @subdomain = subdomain.split(".").first
98
100
  end
99
101
  end
100
102
 
@@ -1,3 +1,3 @@
1
1
  module CamperVan
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -332,6 +332,18 @@ describe CamperVan::Channel do
332
332
  @client.sent.last.must_match ":joe!joe@campfire PRIVMSG #test :hello there"
333
333
  end
334
334
 
335
+ it "splits text messages on newline and carriage returns" do
336
+ @channel.map_message_to_irc msg("Text", :body => "hello\n\r\r\nthere")
337
+ @client.sent[-2].must_match ":joe!joe@campfire PRIVMSG #test :hello"
338
+ @client.sent[-1].must_match ":joe!joe@campfire PRIVMSG #test :there"
339
+ end
340
+
341
+ it "sends the first few lines, split by newline or carriage return, for a paste" do
342
+ @channel.map_message_to_irc msg("Paste", :body => "foo\r\nbar\nbaz\nbleh")
343
+ @client.sent[-4].must_match %r(:joe\S+ PRIVMSG #test :> foo)
344
+ @client.sent.last.must_match %r(:joe\S+ PRIVMSG #test .*room/10/paste/1234)
345
+ end
346
+
335
347
  it "sends a privmsg with the pasted url and the first line when a user pastes something" do
336
348
  @channel.map_message_to_irc msg("Paste", :body => "foo\nbar\nbaz\nbleh")
337
349
  @client.sent.last.must_match %r(:joe\S+ PRIVMSG #test .*room/10/paste/1234)
@@ -481,6 +493,13 @@ describe CamperVan::Channel do
481
493
  @client.sent.last.must_match %r(:joe\S+ PRIVMSG #test .*twitter.com/aniero/status/12345.*)
482
494
  end
483
495
 
496
+ it "splits on newline or carriage returns in tweets" do
497
+ body = "hello world\nsays me -- @author, twitter.com/aniero/status/12345.*"
498
+ @channel.map_message_to_irc msg("Tweet", :body => body)
499
+ @client.sent[-2].must_match %r(:joe\S+ PRIVMSG #test :hello world)
500
+ @client.sent.last.must_match %r(:joe\S+ PRIVMSG #test :says.*twitter.com/aniero/status/12345.*)
501
+ end
502
+
484
503
  # it "sends a notice with the message when the system sends a message"
485
504
 
486
505
  it "marks the user as away when a user goes idle" do
@@ -42,6 +42,12 @@ describe CamperVan::IRCD do
42
42
  @server.api_key.must_equal "asdf1234"
43
43
  end
44
44
 
45
+ it "only uses the subdomain if a full domain is specified" do
46
+ @server.handle :pass => ["test.campfirenow.com:asdf1234"]
47
+ @server.subdomain.must_equal "test"
48
+ @server.api_key.must_equal "asdf1234"
49
+ end
50
+
45
51
  it "saves the nickname from the NICK command" do
46
52
  @server.handle :nick => ["nathan"]
47
53
  @server.nick.must_equal "nathan"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camper_van
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-17 00:00:00.000000000 Z
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -150,10 +150,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  segments:
152
152
  - 0
153
- hash: -442402109143344785
153
+ hash: -3050987797857657263
154
154
  requirements: []
155
155
  rubyforge_project: camper_van
156
- rubygems_version: 1.8.23
156
+ rubygems_version: 1.8.25
157
157
  signing_key:
158
158
  specification_version: 3
159
159
  summary: An IRC to Campfire bridge