Class: MatrixQQ::QQ::ForwardGroup
- Inherits:
-
Object
- Object
- MatrixQQ::QQ::ForwardGroup
- Defined in:
- lib/matrix_qq/qq/forward_group/main.rb,
lib/matrix_qq/qq/forward_group/matrix.rb
Overview
send group massage to other
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) ⇒ ForwardGroup
constructor
A new instance of ForwardGroup.
- #run ⇒ Object
- #run_all ⇒ Object
- #run_exact ⇒ Object
Constructor Details
#initialize(dbus, matrix, info) ⇒ ForwardGroup
Returns a new instance of ForwardGroup.
10 11 12 13 14 |
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 10 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.
6 7 8 |
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 6 def send_to @send_to end |
Instance Method Details
#call_module(room, type, hackin = {}) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 41 def call_module(room, type, hackin = {}) info = @info.merge hackin ForwardGroup.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
16 17 18 19 20 |
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 16 def run return unless @info.is_a? Hash all = run_exact room, value run_all room, value if all end |
#run_all ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 32 def run_all tunnel = Config[:tunnel]['group'] return if tunnel.nil? return unless tunnel[:type] == 'all' tunnel[:to].each_pair do |room, type| call_module room, type, print_room: true end end |
#run_exact ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/matrix_qq/qq/forward_group/main.rb', line 22 def run_exact tunnel = Config[:tunnel][@info['group_id'].to_s] return false if tunnel.nil? return false unless tunnel[:type] == 'group' tunnel[:to].each_pair do |room, type| call_module room, type end MatrixQQ.intercept? tunnel end |