#!/usr/bin/env ruby require 'matrix_qq' config = File.join(ENV['HOME'], '.config', 'matrix-qq', 'config.rb') unless File.size? config File.open config, 'w' do |f| f.puts %(module MatrixQQ Config = { tunnel: { # '#example:matrix.org' => { # type: 'matrix', # to: { '123456789' => 'group' } # }, # '123456789' => { # type: 'group', # to: { '#example:matrix.org' => 'matrix' } # }, # '10000' => { # type: 'friend', # intercept: false, # to: { '!abcdef:matrix.org' => 'matrix' } # }, # 'friend' => { # type: 'all', # to: { '#friend:matrix.org' => 'matrix' } # } } }.freeze end) end end load config LOG = if ARGV.include? '-q' open '/dev/null', 'w' else STDOUT end session_bus = DBus::SessionBus.instance matrix = MatrixQQ::Matrix.new session_bus LOG.puts 'Matrix inited' qq = MatrixQQ::QQ.new session_bus LOG.puts 'QQ inited' matrix.qq_dbus = qq.dbus qq.matrix_dbus = matrix.dbus main = DBus::Main.new main << session_bus LOG.puts 'Started' main.run