iirc 0.2.9 → 0.4.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.
data/lib/iirc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IIRC
4
- VERSION = "0.2.9"
4
+ VERSION = "0.4.1"
5
5
  end
data/lib/iirc.rb CHANGED
@@ -4,13 +4,17 @@ require_relative "iirc/event"
4
4
  require_relative "iirc/sender"
5
5
  require_relative "iirc/user"
6
6
 
7
+ require_relative "iirc/numerics"
8
+
7
9
  require_relative "iirc/bot"
10
+ require_relative "iirc/bot/accept_invites"
8
11
  require_relative "iirc/bot/ambient"
9
12
  require_relative "iirc/bot/autojoin"
10
13
  require_relative "iirc/bot/channels"
11
14
  require_relative "iirc/bot/configure"
12
15
  require_relative "iirc/bot/formatting"
13
16
  require_relative "iirc/bot/hooks"
17
+ require_relative "iirc/bot/isupport"
14
18
  require_relative "iirc/bot/members"
15
19
  require_relative "iirc/bot/oper_up"
16
20
  require_relative "iirc/bot/parsing"
@@ -38,9 +42,14 @@ module IIRC
38
42
  include Configure
39
43
  include Pong
40
44
  include TrackOwnNick
45
+ include ReplyTarget
46
+
47
+ def self.run(host, port=6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context, **user_params, &blk)
48
+ socket = IIRC.dial(host, port,
49
+ local_host: local_host, local_port: local_port,
50
+ ssl_context: ssl_context)
41
51
 
42
- def self.run(host, port=6697, ssl_context: SSL.default_context, **user_params, &blk)
43
- socket = IIRC.dial(host, port, ssl_context: ssl_context)
52
+ user_params[:nick] = self.name&.split('::').last if !user_params.key?(:nick)
44
53
 
45
54
  new(socket, **user_params).tap { |bot|
46
55
  bot.register!
@@ -63,7 +72,7 @@ module IIRC
63
72
  include Bot::Formatting
64
73
  include Bot::AutoJoin
65
74
  include Bot::Verbs
66
- include Bot::AmbientVerbs
75
+ include Bot::Ambient
67
76
  include Bot::RegexHooks
68
77
  end
69
78
 
@@ -100,11 +109,13 @@ module IIRC
100
109
  end
101
110
 
102
111
  module_function
103
- def dial(host, port=6697, ssl_context: SSL.default_context)
112
+ def dial(host, port=6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context)
104
113
  require 'socket'
105
114
 
106
- Socket.tcp(host, port).then { |socket|
115
+ Socket.tcp(host, port, local_host, local_port).then { |socket|
107
116
  if ssl_context
117
+ ssl_context = SSL.send(ssl_context) if ssl_context.is_a? Symbol
118
+
108
119
  OpenSSL::SSL::SSLSocket.new(socket, ssl_context).tap { |socket|
109
120
  socket.hostname = host
110
121
  socket.connect
@@ -118,4 +129,4 @@ end
118
129
 
119
130
  def IIRC(*args, **kwargs, &blk)
120
131
  Class.new(IIRC::Batteries, &blk)
121
- end
132
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iirc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mooff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-24 00:00:00.000000000 Z
11
+ date: 2022-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ircparser
@@ -33,6 +33,7 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - ".github/workflows/main.yml"
35
35
  - ".gitignore"
36
+ - ".yardopts"
36
37
  - CHANGELOG.md
37
38
  - Gemfile
38
39
  - LICENSE
@@ -46,6 +47,7 @@ files:
46
47
  - iirc.gemspec
47
48
  - lib/iirc.rb
48
49
  - lib/iirc/bot.rb
50
+ - lib/iirc/bot/accept_invites.rb
49
51
  - lib/iirc/bot/ambient.rb
50
52
  - lib/iirc/bot/autojoin.rb
51
53
  - lib/iirc/bot/channels.rb
@@ -56,6 +58,7 @@ files:
56
58
  - lib/iirc/bot/ircv3/caps.rb
57
59
  - lib/iirc/bot/ircv3/labeled_requests.rb
58
60
  - lib/iirc/bot/ircv3/parsing.rb
61
+ - lib/iirc/bot/isupport.rb
59
62
  - lib/iirc/bot/members.rb
60
63
  - lib/iirc/bot/oper_up.rb
61
64
  - lib/iirc/bot/parsing.rb
@@ -68,6 +71,7 @@ files:
68
71
  - lib/iirc/bot/track_own_nick.rb
69
72
  - lib/iirc/bot/verbs.rb
70
73
  - lib/iirc/event.rb
74
+ - lib/iirc/numerics.rb
71
75
  - lib/iirc/sender.rb
72
76
  - lib/iirc/user.rb
73
77
  - lib/iirc/version.rb