grinch-identify 1.7.0 → 1.7.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.
- checksums.yaml +4 -4
- data/lib/cinch/plugins/identify.rb +14 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a476ca9d0693b94886ad6ee459d68693c90569d860649bf80160e1cdf97a77a
|
4
|
+
data.tar.gz: '0096747961c371491ca6a307402fc39f9aa53d655e43f165e3bf9dc4c252357b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f4923e1e29c61e7952d57b81d1a99ba1267deb880d3950acd7baf9edbf2ebe9e746e9506369fe0e8c02498c8b7c1335d31bb85ea43ea9d488b84bd2200e0b3a
|
7
|
+
data.tar.gz: 88455af01cef3a49fb5f6ecd66a4f5891327da78b4b4ddb357c8701a47a6854018ccaa708422d1776e52eea662d07da74e0ceeeda54976d35ca8d4c0cdccf02a
|
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "openssl"
|
3
4
|
|
4
5
|
module Cinch
|
@@ -7,7 +8,7 @@ module Cinch
|
|
7
8
|
include Cinch::Plugin
|
8
9
|
|
9
10
|
listen_to :connect, method: :identify
|
10
|
-
def identify(
|
11
|
+
def identify(_m)
|
11
12
|
case config[:type]
|
12
13
|
when :quakenet
|
13
14
|
debug "Identifying with Q"
|
@@ -34,8 +35,8 @@ module Cinch
|
|
34
35
|
|
35
36
|
match(/^You are successfully identified as/, use_prefix: false, use_suffix: false, react_on: :private, method: :identified_nickserv)
|
36
37
|
match(/^You are now identified for/, use_prefix: false, use_suffix: false, react_on: :private, method: :identified_nickserv)
|
37
|
-
match(/^Password accepted
|
38
|
-
match(/^Hasło przyjęte
|
38
|
+
match(/^Password accepted -+ you are now recognized\./, use_prefix: false, use_suffix: false, react_on: :private, method: :identified_nickserv)
|
39
|
+
match(/^Hasło przyjęte -+ jesteś zidentyfikowany/, use_prefix: false, use_suffix: false, react_on: :private, method: :identified_nickserv)
|
39
40
|
def identified_nickserv(m)
|
40
41
|
service_name = config[:service_name] || "nickserv"
|
41
42
|
if m.user == User(service_name) && config[:type] == :nickserv
|
@@ -47,14 +48,14 @@ module Cinch
|
|
47
48
|
match(/^CHALLENGE (.+?) (.+)$/, use_prefix: false, use_suffix: false, react_on: :notice, method: :challengeauth)
|
48
49
|
def challengeauth(m)
|
49
50
|
return unless m.user && m.user.nick == "Q"
|
50
|
-
return unless [
|
51
|
+
return unless %i[secure_quakenet challengeauth].include?(config[:type])
|
51
52
|
|
52
53
|
if match = m.message.match(/^CHALLENGE (.+?) (.+)$/)
|
53
54
|
challenge = match[1]
|
54
55
|
@bot.debug "Received challenge '#{challenge}'"
|
55
56
|
|
56
57
|
username = config[:username].irc_downcase(:rfc1459)
|
57
|
-
password = config[:password][0,10]
|
58
|
+
password = config[:password][0, 10]
|
58
59
|
|
59
60
|
key = OpenSSL::Digest::SHA256.hexdigest(username + ":" + OpenSSL::Digest::SHA256.hexdigest(password))
|
60
61
|
response = OpenSSL::HMAC.hexdigest("SHA256", key, challenge)
|
@@ -64,7 +65,7 @@ module Cinch
|
|
64
65
|
|
65
66
|
match(/^You are now logged in as/, use_prefix: false, use_suffix: false, react_on: :notice, method: :identified_quakenet)
|
66
67
|
def identified_quakenet(m)
|
67
|
-
if m.user == User("q") && [
|
68
|
+
if m.user == User("q") && %i[quakenet secure_quakenet challengeauth].include?(config[:type])
|
68
69
|
debug "Identified with Q"
|
69
70
|
@bot.handlers.dispatch(:identified, m)
|
70
71
|
end
|
@@ -81,6 +82,7 @@ module Cinch
|
|
81
82
|
end
|
82
83
|
|
83
84
|
private
|
85
|
+
|
84
86
|
def identify_dalnet
|
85
87
|
User("Nickserv@services.dal.net").send("identify %s" % [config[:password]])
|
86
88
|
end
|
@@ -96,11 +98,11 @@ module Cinch
|
|
96
98
|
def identify_nickserv
|
97
99
|
service_name = config[:service_name] || "nickserv"
|
98
100
|
service_name = service_name.split("@").first
|
99
|
-
if config[:username]
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
cmd = if config[:username]
|
102
|
+
"identify %s %s" % [config[:username], config[:password]]
|
103
|
+
else
|
104
|
+
"identify %s" % [config[:password]]
|
105
|
+
end
|
104
106
|
User(service_name).send(cmd)
|
105
107
|
end
|
106
108
|
|