irc-socket 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/irc-socket.rb +17 -4
  3. metadata +11 -4
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require "spec/rake/spectask"
5
5
  require "rake/rdoctask"
6
6
 
7
7
  NAME = 'irc-socket'
8
- VERSION = '0.9.4'
8
+ VERSION = '0.9.5'
9
9
  CLEAN.include ["*.gem", "rdoc"]
10
10
 
11
11
  RDOC_OPTS = [
data/lib/irc-socket.rb CHANGED
@@ -53,8 +53,8 @@ class IRCSocket
53
53
  # while data = irc.read
54
54
  # puts data
55
55
  # end
56
- def self.open(server, port=6667)
57
- irc = new(server, port)
56
+ def self.open(server, port=6667, ssl=false)
57
+ irc = new(server, port, ssl)
58
58
  irc.connect
59
59
  irc
60
60
  end
@@ -64,9 +64,10 @@ class IRCSocket
64
64
  #
65
65
  # NOTE: Using the block form does not mean the socket will send the applicable QUIT
66
66
  # command to leave the IRC server. You must send this yourself.
67
- def initialize(server, port=6667)
67
+ def initialize(server, port=6667, ssl=false)
68
68
  @server = server
69
69
  @port = port
70
+ @ssl = ssl
70
71
 
71
72
  @socket = nil
72
73
  @connected = false
@@ -86,7 +87,19 @@ class IRCSocket
86
87
  # Connect to an IRC server, returns true on a successful connection, or
87
88
  # raises otherwise
88
89
  def connect
89
- @socket = TCPSocket.new(server, port)
90
+ socket = TCPSocket.new(server, port)
91
+
92
+ if @ssl
93
+ require 'openssl'
94
+
95
+ ssl = OpenSSL::SSL::SSLContext.new
96
+ ssl.verify_mode = OpenSSL::SSL::VERIFY_NONE
97
+ @socket = OpenSSL::SSL::SSLSocket.new(socket, ssl)
98
+ @socket.sync = true
99
+ @socket.connect
100
+ else
101
+ @socket = socket
102
+ end
90
103
  rescue Interrupt
91
104
  raise
92
105
  rescue Exception
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irc-socket
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 49
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 9
8
- - 4
9
- version: 0.9.4
9
+ - 5
10
+ version: 0.9.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - Lee 'injekt' Jarvis
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-09 00:00:00 +01:00
18
+ date: 2010-05-23 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - "="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 27
27
30
  segments:
28
31
  - 1
29
32
  - 3
@@ -56,25 +59,29 @@ rdoc_options:
56
59
  require_paths:
57
60
  - lib
58
61
  required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
59
63
  requirements:
60
64
  - - ">="
61
65
  - !ruby/object:Gem::Version
66
+ hash: 63
62
67
  segments:
63
68
  - 1
64
69
  - 8
65
70
  - 4
66
71
  version: 1.8.4
67
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
68
74
  requirements:
69
75
  - - ">="
70
76
  - !ruby/object:Gem::Version
77
+ hash: 3
71
78
  segments:
72
79
  - 0
73
80
  version: "0"
74
81
  requirements: []
75
82
 
76
83
  rubyforge_project:
77
- rubygems_version: 1.3.6
84
+ rubygems_version: 1.3.7
78
85
  signing_key:
79
86
  specification_version: 3
80
87
  summary: An IRC wrapper around TCPSocket