Module: Meshchat

Extended by:
ActiveSupport::Autoload
Defined in:
lib/meshchat/ui/cli/readline_input.rb,
lib/meshchat.rb,
lib/meshchat/ui.rb,
lib/meshchat/debug.rb,
lib/meshchat/ui/cli.rb,
lib/meshchat/network.rb,
lib/meshchat/version.rb,
lib/meshchat/encryption.rb,
lib/meshchat/ui/command.rb,
lib/meshchat/ui/display.rb,
lib/meshchat/models/node.rb,
lib/meshchat/ui/cli/base.rb,
lib/meshchat/ui/notifier.rb,
lib/meshchat/configuration.rb,
lib/meshchat/network/local.rb,
lib/meshchat/network/errors.rb,
lib/meshchat/network/remote.rb,
lib/meshchat/ui/command/irb.rb,
lib/meshchat/network/message.rb,
lib/meshchat/ui/command/base.rb,
lib/meshchat/ui/command/bind.rb,
lib/meshchat/ui/command/chat.rb,
lib/meshchat/ui/command/exit.rb,
lib/meshchat/ui/command/help.rb,
lib/meshchat/ui/command/ping.rb,
lib/meshchat/ui/command/roll.rb,
lib/meshchat/ui/display/base.rb,
lib/meshchat/network/incoming.rb,
lib/meshchat/ui/command/emote.rb,
lib/meshchat/ui/command/share.rb,
lib/meshchat/ui/notifier/base.rb,
lib/meshchat/ui/command/config.rb,
lib/meshchat/ui/command/import.rb,
lib/meshchat/ui/command/online.rb,
lib/meshchat/ui/command/server.rb,
lib/meshchat/encryption/aes_rsa.rb,
lib/meshchat/network/dispatcher.rb,
lib/meshchat/ui/command/offline.rb,
lib/meshchat/ui/command/whisper.rb,
lib/meshchat/ui/display/manager.rb,
lib/meshchat/ui/command/identity.rb,
lib/meshchat/ui/command/ping_all.rb,
lib/meshchat/network/local/server.rb,
lib/meshchat/network/message/base.rb,
lib/meshchat/network/message/chat.rb,
lib/meshchat/network/message/ping.rb,
lib/meshchat/network/remote/relay.rb,
lib/meshchat/ui/cli/input_factory.rb,
lib/meshchat/network/message/emote.rb,
lib/meshchat/configuration/database.rb,
lib/meshchat/configuration/identity.rb,
lib/meshchat/configuration/settings.rb,
lib/meshchat/encryption/passthrough.rb,
lib/meshchat/ui/command/node_finder.rb,
lib/meshchat/ui/notifier/lib_notify.rb,
lib/meshchat/configuration/hash_file.rb,
lib/meshchat/network/message/factory.rb,
lib/meshchat/network/message/whisper.rb,
lib/meshchat/ui/command/whisper_lock.rb,
lib/meshchat/configuration/app_config.rb,
lib/meshchat/network/local/connection.rb,
lib/meshchat/ui/command/all_chat_lock.rb,
lib/meshchat/network/message/node_list.rb,
lib/meshchat/network/remote/connection.rb,
lib/meshchat/network/remote/relay_pool.rb,
lib/meshchat/network/message/disconnect.rb,
lib/meshchat/network/message/ping_reply.rb,
lib/meshchat/ui/cli/keyboard_line_input.rb,
lib/meshchat/ui/command/send_disconnect.rb,
lib/meshchat/ui/display/readline_display.rb,
lib/meshchat/network/message/node_list_diff.rb,
lib/meshchat/network/message/node_list_hash.rb,
lib/meshchat/network/incoming/message_decryptor.rb,
lib/meshchat/network/incoming/message_processor.rb,
lib/meshchat/network/incoming/request_processor.rb

Overview

frozen_string_literal: true

Defined Under Namespace

Modules: Configuration, Debug, Encryption, Network, Ui Classes: Node

Constant Summary collapse

VERSION =
'0.12.1'

Class Method Summary collapse

Class Method Details

.bootstrap_runloop(app_config) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/meshchat.rb', line 59

def bootstrap_runloop(app_config)
  # 1. hook up the display / output 'device'
  #    - responsible for notifications
  #    - created in Configuration
  display = Display

  # 2. create the message dispatcher
  #    - boots the local and relay network connections
  #    - sends the messages out to the network
  #    - tries p2p first, than uses the relays
  message_dispatcher = Network::Dispatcher.new

  # 3. hook up the keyboard / input 'device'
  #    - tesponsible for parsing input
  input_receiver = Ui::CLI.new(
    message_dispatcher,
    message_dispatcher._message_factory,
    display
  )

  # by default the app_config[:input] is
  # Meshchat::Cli::KeyboardLineInput
  # EM.open_keyboard(app_config[:input], input_receiver)
  input = app_config[:input].new(input_receiver)
  input.try(:start)
end

.start(overrides = {}) ⇒ Object

Parameters:

  • overrides (Hash) (defaults to: {})

Options Hash (overrides):

  • on_display_start (Proc)

    what to do upon start of the display manager

  • display (class)

    the display ui to use inherited from Display::Base



48
49
50
51
52
53
54
55
56
57
# File 'lib/meshchat.rb', line 48

def start(overrides = {})
  app_config = Configuration::AppConfig.new(overrides)
  app_config.validate

  # if everything is configured correctly, boot the app
  # this handles all of the asyncronous stuff
  EventMachine.run do
    bootstrap_runloop(app_config)
  end
end