cinch-identify 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +9 -4
  2. data/lib/cinch/plugins/identify.rb +19 -0
  3. metadata +4 -4
data/README.md CHANGED
@@ -35,10 +35,10 @@ None.
35
35
 
36
36
  ## Options
37
37
  ### :type
38
- The type of authentication. `:nickserv` for NickServ, `:quakenet` for
39
- the insecure _auth_ command on QuakeNet and `:secure_quakenet` or
40
- `:challengeauth` for the more secure _challengeauth_. `:kreynet` for
41
- KreyNet.
38
+ The type of authentication. `:nickserv` for NickServ, `:userserv` for
39
+ UserServ, `:quakenet` for the insecure _auth_ command on QuakeNet and
40
+ `:secure_quakenet` or `:challengeauth` for the more secure
41
+ _challengeauth_. `:kreynet` for KreyNet.
42
42
 
43
43
  ### :username
44
44
  The username to use for authentication. Do not set this when using
@@ -48,6 +48,11 @@ nick (e.g. dancer-ircd.)
48
48
  ### :password
49
49
  The password to use for authentication
50
50
 
51
+ ### :service_name
52
+ The nick name of the service to send the identification message to.
53
+ This option is currently only being used for `:userserv` and defaults
54
+ to `"UserServ"`.
55
+
51
56
  ### Example configuration
52
57
  Check the install instructions for an example configuration.
53
58
 
@@ -20,6 +20,9 @@ module Cinch
20
20
  when :kreynet
21
21
  debug "Identifying with K on KreyNet"
22
22
  identify_kreynet
23
+ when :userserv
24
+ debug "Identifying with UserServ"
25
+ identify_userserv
23
26
  else
24
27
  debug "Not going to identify with unknown type #{config[:type].inspect}"
25
28
  end
@@ -36,6 +39,8 @@ module Cinch
36
39
  match(/^CHALLENGE (.+?) (.+)$/, use_prefix: false, use_suffix: false, react_on: :notice, method: :challengeauth)
37
40
  def challengeauth(m)
38
41
  return unless m.user && m.user.nick == "Q"
42
+ return unless [:secure_quakenet, :challengeauth].include?(config[:type])
43
+
39
44
  if match = m.message.match(/^CHALLENGE (.+?) (.+)$/)
40
45
  challenge = match[1]
41
46
  @bot.debug "Received challenge '#{challenge}'"
@@ -57,6 +62,15 @@ module Cinch
57
62
  end
58
63
  end
59
64
 
65
+ match(/^You are now logged in as/, use_prefix: false, use_suffix: false, react_on: :notice, method: :identified_userserv)
66
+ def identified_userserv(m)
67
+ service_name = config[:service_name] || "UserServ"
68
+ if m.user == User(service_name) && config[:type] == :userserv
69
+ debug "Identified with UserServ"
70
+ @bot.handlers.dispatch :identified, m
71
+ end
72
+ end
73
+
60
74
  private
61
75
  def identify_quakenet
62
76
  User("Q@CServe.quakenet.org").send("auth %s %s" % [config[:username], config[:password]])
@@ -77,6 +91,11 @@ module Cinch
77
91
  def identify_kreynet
78
92
  User("K!k@krey.net").send("LOGIN %s %s" % [config[:username], config[:password]])
79
93
  end
94
+
95
+ def identify_userserv
96
+ service_name = config[:service_name] || "UserServ"
97
+ User(service_name).send("LOGIN %s %s" % [config[:username], config[:password]])
98
+ end
80
99
  end
81
100
  end
82
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch-identify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-06 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cinch
16
- requirement: &20695720 !ruby/object:Gem::Requirement
16
+ requirement: &20029340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *20695720
24
+ version_requirements: *20029340
25
25
  description: A plugin allowing Cinch bots to automatically identify with services.
26
26
  Supported are NickServ, QuakeNet and KreyNet.
27
27
  email: