meshchat 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/meshchat.rb +6 -5
- data/lib/meshchat/cli.rb +0 -1
- data/lib/meshchat/message/node_list.rb +4 -1
- data/lib/meshchat/message/node_list_hash.rb +2 -0
- data/lib/meshchat/message/ping_reply.rb +1 -1
- data/lib/meshchat/net/listener/server.rb +8 -0
- data/lib/meshchat/notifier/base.rb +3 -22
- data/lib/meshchat/version.rb +1 -1
- metadata +2 -30
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d92a2e7b4e026335fc14b3c574cd4252a5f0dbb7
         | 
| 4 | 
            +
              data.tar.gz: 37348ba21effad3647ef2ccd154235b371243810
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6477e3bff10e2bd795ad277a6376351c87fd520796a0bc717baf27776a0698caecfc6573190cb4074c9a3feea2f4fe1fd930d518ce18212978297e39af9a17fc
         | 
| 7 | 
            +
              data.tar.gz: a3031e4f8b1a5196c3407798006c8ef750eabd83ae791973505480bae32399380d6f76d87c1ff1f400b010452b95f3854fb30520ced07f28e4a355818dcc333d
         | 
    
        data/README.md
    CHANGED
    
    | @@ -8,12 +8,15 @@ See [Spiced Gracken](https://github.com/NullVoxPopuli/spiced_gracken) | |
| 8 8 |  | 
| 9 9 | 
             
            In order to use meshchat with your own interface, you only need to pass in your own implementations of `Display::Base` and `CLI::Base`
         | 
| 10 10 |  | 
| 11 | 
            +
            Optionally, you may pass in a notifier to have the mesh-chat trigger notifications for your system
         | 
| 12 | 
            +
             | 
| 11 13 | 
             
            ```ruby
         | 
| 12 14 | 
             
            MeshChat.start(
         | 
| 13 15 | 
             
              client_name: NAME, # name of your client
         | 
| 14 16 | 
             
              client_version: VERSION, # version of your client
         | 
| 15 | 
            -
              display: ui, # your class  | 
| 16 | 
            -
              input: input, # your class  | 
| 17 | 
            +
              display: ui, # your class implementing `Display::Base`
         | 
| 18 | 
            +
              input: input, # your class implementing `CLI::Base`
         | 
| 19 | 
            +
              notifier: notifier, # your class implementing `Notifier::Base`
         | 
| 17 20 | 
             
              on_display_start: ->{ MeshChat::CLI.check_startup_settings } # optional
         | 
| 18 21 | 
             
            )
         | 
| 19 22 | 
             
            ```
         | 
    
        data/lib/meshchat.rb
    CHANGED
    
    | @@ -4,10 +4,8 @@ require 'socket' | |
| 4 4 | 
             
            require 'json'
         | 
| 5 5 | 
             
            require 'date'
         | 
| 6 6 | 
             
            require 'colorize'
         | 
| 7 | 
            -
            require 'curses'
         | 
| 8 7 | 
             
            require 'io/console'
         | 
| 9 8 | 
             
            require "readline"
         | 
| 10 | 
            -
             | 
| 11 9 | 
             
            require 'logger'
         | 
| 12 10 |  | 
| 13 11 | 
             
            # required gems
         | 
| @@ -16,7 +14,6 @@ require 'sqlite3' | |
| 16 14 | 
             
            require 'active_record'
         | 
| 17 15 | 
             
            require 'curb'
         | 
| 18 16 | 
             
            require 'thin'
         | 
| 19 | 
            -
            require 'libnotify'
         | 
| 20 17 |  | 
| 21 18 | 
             
            # active support extensions
         | 
| 22 19 | 
             
            require 'active_support/core_ext/module/delegation'
         | 
| @@ -47,7 +44,6 @@ module MeshChat | |
| 47 44 | 
             
              Settings = Config::Settings
         | 
| 48 45 | 
             
              Node = Models::Entry
         | 
| 49 46 | 
             
              Cipher = Encryption
         | 
| 50 | 
            -
              Notify = Notifier::Base
         | 
| 51 47 |  | 
| 52 48 | 
             
              module_function
         | 
| 53 49 |  | 
| @@ -59,12 +55,17 @@ module MeshChat | |
| 59 55 | 
             
                  display: Display::Base,
         | 
| 60 56 | 
             
                  client_name: NAME,
         | 
| 61 57 | 
             
                  client_version: VERSION,
         | 
| 62 | 
            -
                  input: CLI::Base
         | 
| 58 | 
            +
                  input: CLI::Base,
         | 
| 59 | 
            +
                  notifier: Notifier::Base
         | 
| 63 60 | 
             
                }
         | 
| 64 61 | 
             
                options = defaults.merge(overrides)
         | 
| 65 62 |  | 
| 66 63 | 
             
                # before doing anything, ensure we have a place to store data
         | 
| 67 64 | 
             
                Database.setup_storage
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                # set up the notifier (if there is one)
         | 
| 67 | 
            +
                const_set(:Notify, options[:notifier])
         | 
| 68 | 
            +
             | 
| 68 69 | 
             
                # set the options / overrides!
         | 
| 69 70 | 
             
                Instance.start(options)
         | 
| 70 71 | 
             
              end
         | 
    
        data/lib/meshchat/cli.rb
    CHANGED
    
    
| @@ -15,6 +15,14 @@ module MeshChat | |
| 15 15 | 
             
                    # TODO: do we want to return an error if
         | 
| 16 16 | 
             
                    # we can't decrypt?
         | 
| 17 17 |  | 
| 18 | 
            +
                    def self.run!(*)
         | 
| 19 | 
            +
                      # start the server
         | 
| 20 | 
            +
                      super
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      # send a pingall to see who's online
         | 
| 23 | 
            +
                      MeshChat::Command::PingAll.new.handle
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
             | 
| 18 26 | 
             
                    get '/' do
         | 
| 19 27 | 
             
                      process_request
         | 
| 20 28 | 
             
                    end
         | 
| @@ -13,7 +13,8 @@ module MeshChat | |
| 13 13 |  | 
| 14 14 | 
             
                  # Notifier::Base is a singleton
         | 
| 15 15 | 
             
                  # Not all Notifiers need to be singletons,
         | 
| 16 | 
            -
                  # but it doesn't really make sense to have more than one
         | 
| 16 | 
            +
                  # but it doesn't really make sense to have more than one.
         | 
| 17 | 
            +
                  # An OS generally only has one notification system
         | 
| 17 18 | 
             
                  class << self
         | 
| 18 19 | 
             
                    delegate :show, to: :instance
         | 
| 19 20 |  | 
| @@ -23,27 +24,7 @@ module MeshChat | |
| 23 24 | 
             
                  end
         | 
| 24 25 |  | 
| 25 26 | 
             
                  def show(*args)
         | 
| 26 | 
            -
                     | 
| 27 | 
            -
                      yield(notify) if block_given?
         | 
| 28 | 
            -
                    end
         | 
| 29 | 
            -
                  end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                  private
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                  def libnotify_message()
         | 
| 34 | 
            -
                    @message ||= Libnotify.new do |notify|
         | 
| 35 | 
            -
                      notify.summary    = MeshChat::NAME
         | 
| 36 | 
            -
                      notify.body       = ""
         | 
| 37 | 
            -
                      notify.timeout    = 1.5         # 1.5 (s), 1000 (ms), "2", nil, false
         | 
| 38 | 
            -
                      notify.urgency    = :normal   # :low, :normal, :critical
         | 
| 39 | 
            -
                      notify.append     = false       # default true - append onto existing notification
         | 
| 40 | 
            -
                      notify.transient  = false        # default false - keep the notifications around after display
         | 
| 41 | 
            -
                      # TODO: this will vary on each system - maybe package icons
         | 
| 42 | 
            -
                      # with the gem
         | 
| 43 | 
            -
                      notify.icon_path  = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
         | 
| 44 | 
            -
                    end
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                    @message
         | 
| 27 | 
            +
                    # by default don't notify
         | 
| 47 28 | 
             
                  end
         | 
| 48 29 | 
             
                end
         | 
| 49 30 | 
             
              end
         | 
    
        data/lib/meshchat/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: meshchat
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.6. | 
| 4 | 
            +
              version: 0.6.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - L. Preston Sego III
         | 
| @@ -108,34 +108,6 @@ dependencies: | |
| 108 108 | 
             
                - - ">="
         | 
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 110 | 
             
                    version: '0'
         | 
| 111 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            -
              name: curses
         | 
| 113 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 | 
            -
                requirements:
         | 
| 115 | 
            -
                - - ">="
         | 
| 116 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: '0'
         | 
| 118 | 
            -
              type: :runtime
         | 
| 119 | 
            -
              prerelease: false
         | 
| 120 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            -
                requirements:
         | 
| 122 | 
            -
                - - ">="
         | 
| 123 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version: '0'
         | 
| 125 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            -
              name: libnotify
         | 
| 127 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            -
                requirements:
         | 
| 129 | 
            -
                - - ">="
         | 
| 130 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            -
                    version: '0'
         | 
| 132 | 
            -
              type: :runtime
         | 
| 133 | 
            -
              prerelease: false
         | 
| 134 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 | 
            -
                requirements:
         | 
| 136 | 
            -
                - - ">="
         | 
| 137 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            -
                    version: '0'
         | 
| 139 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 140 112 | 
             
              name: awesome_print
         | 
| 141 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -285,6 +257,6 @@ rubyforge_project: | |
| 285 257 | 
             
            rubygems_version: 2.4.7
         | 
| 286 258 | 
             
            signing_key: 
         | 
| 287 259 | 
             
            specification_version: 4
         | 
| 288 | 
            -
            summary: MeshChat-0.6. | 
| 260 | 
            +
            summary: MeshChat-0.6.3
         | 
| 289 261 | 
             
            test_files: []
         | 
| 290 262 | 
             
            has_rdoc: 
         |