grinch-identify 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cinch/plugins/identify.rb +14 -12
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af84c50edd0bda9b174b3439184668c2b93d12c1013aaed0d7284c9cbf42ca04
4
- data.tar.gz: dc508374a5dddc19f2536088efc434aa2b3308542b368da7798b4d71fd536522
3
+ metadata.gz: 8a476ca9d0693b94886ad6ee459d68693c90569d860649bf80160e1cdf97a77a
4
+ data.tar.gz: '0096747961c371491ca6a307402fc39f9aa53d655e43f165e3bf9dc4c252357b'
5
5
  SHA512:
6
- metadata.gz: b9131dda43dc450aa0328d026c4a1fde9b0e6596d0cae21bc62ee2593e71d3920a71fa0705a80528693541732cb0e5791109ee9f6203fbc5ab5ca7542a3e71da
7
- data.tar.gz: 7926476e05c31352006b43c1a0585194face6cf5309ac8440628365e8beaa89ea089f1eb90c003d2bd7b32599541fe781e9e2689a7a31065f2938366a9b64f1c
6
+ metadata.gz: 5f4923e1e29c61e7952d57b81d1a99ba1267deb880d3950acd7baf9edbf2ebe9e746e9506369fe0e8c02498c8b7c1335d31bb85ea43ea9d488b84bd2200e0b3a
7
+ data.tar.gz: 88455af01cef3a49fb5f6ecd66a4f5891327da78b4b4ddb357c8701a47a6854018ccaa708422d1776e52eea662d07da74e0ceeeda54976d35ca8d4c0cdccf02a
@@ -1,4 +1,5 @@
1
- # -*- coding: utf-8 -*-
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(m)
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 - you are now recognized\./, use_prefix: false, use_suffix: false, react_on: :private, method: :identified_nickserv)
38
- match(/^Hasło przyjęte - jesteś zidentyfikowany/, use_prefix: false, use_suffix: false, react_on: :private, method: :identified_nickserv)
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 [:secure_quakenet, :challengeauth].include?(config[:type])
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") && [:quakenet, :secure_quakenet, :challengeauth].include?(config[:type])
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
- cmd = "identify %s %s" % [config[:username], config[:password]]
101
- else
102
- cmd = "identify %s" % [config[:password]]
103
- end
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grinch-identify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff