Class: MatrixQQ::QQ::ForwardFriend
- Inherits:
-
Object
- Object
- MatrixQQ::QQ::ForwardFriend
- Defined in:
- lib/matrix_qq/qq/forward_friend/main.rb,
lib/matrix_qq/qq/forward_friend/matrix.rb
Defined Under Namespace
Classes: Matrix
Class Attribute Summary collapse
-
.send_to ⇒ Object
Returns the value of attribute send_to.
Instance Method Summary collapse
- #call_module(room, type, hackin = {}) ⇒ Object
-
#initialize(dbus, matrix, info) ⇒ ForwardFriend
constructor
A new instance of ForwardFriend.
- #run ⇒ Object
- #run_all ⇒ Object
- #run_exact ⇒ Object
Constructor Details
#initialize(dbus, matrix, info) ⇒ ForwardFriend
Returns a new instance of ForwardFriend.
9 10 11 12 13 |
# File 'lib/matrix_qq/qq/forward_friend/main.rb', line 9 def initialize(dbus, matrix, info) @dbus = dbus @info = info @matrix = matrix end |
Class Attribute Details
.send_to ⇒ Object
Returns the value of attribute send_to.
5 6 7 |
# File 'lib/matrix_qq/qq/forward_friend/main.rb', line 5 def send_to @send_to end |
Instance Method Details
#call_module(room, type, hackin = {}) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/matrix_qq/qq/forward_friend/main.rb', line 40 def call_module(room, type, hackin = {}) info = @info.merge hackin ForwardFriend.send_to[type.to_s].each do |func| puts "Start #{func.name}" if $VERBOSE func.new(@dbus, @matrix, info, room).run puts "End #{func.name}" if $VERBOSE end end |
#run ⇒ Object
15 16 17 18 19 |
# File 'lib/matrix_qq/qq/forward_friend/main.rb', line 15 def run return unless @info.is_a? Hash return if run_exact run_all end |
#run_all ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/matrix_qq/qq/forward_friend/main.rb', line 31 def run_all tunnel = Config[:tunnel]['friend'] return if tunnel.nil? return unless tunnel[:type] == 'all' tunnel[:to].each_pair do |room, type| call_module room, type, 'print_sender' => true end end |
#run_exact ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/matrix_qq/qq/forward_friend/main.rb', line 21 def run_exact tunnel = Config[:tunnel][@info['user_id'].to_s] return false if tunnel.nil? return false unless tunnel[:type] == 'friend' tunnel[:to].each_pair do |room, type| call_module room, type end MatrixQQ.intercept? tunnel end |