syndi 0.1.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/CHANGELOG.md +0 -0
  4. data/Gemfile +8 -0
  5. data/LICENSE +28 -0
  6. data/README.md +104 -0
  7. data/Rakefile +30 -0
  8. data/WINDOWS.md +64 -0
  9. data/bin/syndi +102 -0
  10. data/bin/syndi-conf +47 -0
  11. data/conf/example.yml +101 -0
  12. data/docs/Events.md +103 -0
  13. data/docs/Upgrade.md +16 -0
  14. data/ext/csyndi/events.c +50 -0
  15. data/ext/csyndi/extconf.rb +20 -0
  16. data/ext/csyndi/integer.c +53 -0
  17. data/ext/csyndi/libauto.c +37 -0
  18. data/ext/csyndi/logger.c +229 -0
  19. data/include/syndi.h +22 -0
  20. data/include/syndi/csyndi.h +38 -0
  21. data/include/syndi/events.h +19 -0
  22. data/include/syndi/integer.h +17 -0
  23. data/include/syndi/logger.h +56 -0
  24. data/lib/csyndi.so +0 -0
  25. data/lib/syndi.rb +137 -0
  26. data/lib/syndi/actress.rb +12 -0
  27. data/lib/syndi/api.rb +7 -0
  28. data/lib/syndi/api/object.rb +29 -0
  29. data/lib/syndi/bot.rb +266 -0
  30. data/lib/syndi/config.rb +113 -0
  31. data/lib/syndi/dsl/base.rb +74 -0
  32. data/lib/syndi/dsl/irc.rb +13 -0
  33. data/lib/syndi/events.rb +130 -0
  34. data/lib/syndi/irc.rb +8 -0
  35. data/lib/syndi/irc/common.rb +63 -0
  36. data/lib/syndi/irc/library.rb +89 -0
  37. data/lib/syndi/irc/object/channel.rb +21 -0
  38. data/lib/syndi/irc/object/entity.rb +90 -0
  39. data/lib/syndi/irc/object/message.rb +99 -0
  40. data/lib/syndi/irc/object/user.rb +139 -0
  41. data/lib/syndi/irc/protocol.rb +161 -0
  42. data/lib/syndi/irc/protocol/numerics.rb +60 -0
  43. data/lib/syndi/irc/sasl/diffie_hellman.rb +36 -0
  44. data/lib/syndi/irc/sasl/mech.rb +7 -0
  45. data/lib/syndi/irc/sasl/mech/dh_blowfish.rb +83 -0
  46. data/lib/syndi/irc/sasl/mech/plain.rb +39 -0
  47. data/lib/syndi/irc/server.rb +301 -0
  48. data/lib/syndi/irc/state/channel_manager.rb +6 -0
  49. data/lib/syndi/irc/state/support.rb +142 -0
  50. data/lib/syndi/irc/state/user_manager.rb +6 -0
  51. data/lib/syndi/irc/std/commands.rb +99 -0
  52. data/lib/syndi/irc/std/numerics.rb +216 -0
  53. data/lib/syndi/jewel.rb +5 -0
  54. data/lib/syndi/jewel/specification.rb +121 -0
  55. data/lib/syndi/jewel/util.rb +27 -0
  56. data/lib/syndi/rubyext/string.rb +10 -0
  57. data/lib/syndi/verbosity.rb +10 -0
  58. data/lib/syndi/version.rb +38 -0
  59. data/spec/helper.rb +37 -0
  60. data/spec/syndi/events_spec.rb +89 -0
  61. data/tasks/compile.rake +15 -0
  62. data/tasks/install.rake +10 -0
  63. data/tasks/package.rake +13 -0
  64. data/tasks/spec.rake +12 -0
  65. metadata +243 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: c5876cdc53db5219da91fc95dcd942786a8402bb
4
+ data.tar.gz: bdaa59d5c4823fc64b7e9a26701424b230d17b94
5
+ !binary "U0hBNTEy":
6
+ metadata.gz: 1aae881581b64b535a17d291f0bdc7a6ecd44590ce12b172a3d05ad57a569bcda6e66ea506e4841cefbbb8a5d8a1a4304f3a196c72190637dc2169d848739c06
7
+ data.tar.gz: 0e8939191f33db34fbf5d63dbc56a180b01c35b4f62692b5ce5f9c0f46855c3b1e084d7eca7843e0edadb192236c9dd7341fc506e8f24780deb918115dd74a5a
data/.yardopts ADDED
@@ -0,0 +1,12 @@
1
+ --title "Auto 4.0 Phoenix"
2
+ --protected
3
+ --private
4
+ --markup markdown
5
+ lib/**/*.rb
6
+ ext/**/*.c
7
+ - LICENSE
8
+ - WINDOWS.md
9
+ - INSTALL.md
10
+ - CHANGELOG.md
11
+ - CONTRIBUTING.md
12
+ - docs/*
data/CHANGELOG.md ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # Copyright (c) 2013, Autumn Perrault, et al. All rights reserved.
2
+ # This free software is distributed under the FreeBSD license (see LICENSE).
3
+
4
+ source :rubygems
5
+
6
+ gemspec :development_group => :dev
7
+
8
+ # vim: set ts=4 sts=2 sw=2 et:
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ (Two-clause "FreeBSD" license.)
2
+
3
+ Copyright (c) 2009-2013, Autumn Perrault
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+
26
+ The views and conclusions contained in the software and documentation are those
27
+ of the authors and should not be interpreted as representing official policies,
28
+ either expressed or implied, of the Syndi Project.
data/README.md ADDED
@@ -0,0 +1,104 @@
1
+ Syndi
2
+ =====
3
+
4
+ _A modern, elegant, extensible multi-protocol chat bot—reloaded._
5
+
6
+ **Formerly known as Auto.**
7
+
8
+ **Version**: 0.1.1 "Phoenix"
9
+ [![Build Status](https://travis-ci.org/syndibot/syndi.png?branch=master)](https://travis-ci.org/syndibot/syndi)
10
+ [![Dependency Status](https://gemnasium.com/syndibot/syndi.png)](https://gemnasium.com/syndibot/syndi)
11
+ [![Code Climate](https://codeclimate.com/github/syndibot/syndi.png)](https://codeclimate.com/github/syndibot/syndi)
12
+
13
+ + [Website](http://syndibot.com) (lots of information)
14
+ + [RubyGems](https://rubygems.org/gems/syndi)
15
+ + [Wiki](https://github.com/syndibot/syndi/wiki)
16
+ + [Mailing List](https://groups.google.com/group/syndibot)
17
+ + [Issue Hub](https://github.com/syndibot/syndi/issues)
18
+
19
+
20
+ Our official IRC channel is [#syndi on irc.freenode.net](irc://irc.freenode.net/#syndi).
21
+
22
+ Synopsis
23
+ --------
24
+
25
+ Syndi is automated chat bot software, developed per this philosophy:
26
+
27
+ * _Friendly_ to users, and to developers.
28
+ * _Simple_, _smart_, and _clean_.
29
+ * _Minimal_ but _extensible_.
30
+
31
+ It is a reboot of Auto, an old IRC bot which, though featureful, suffered of design flaws.
32
+
33
+ ### Is it Production-Ready™?
34
+
35
+ Not yet. Syndi's a fairly sizable project. We're getting close though.
36
+
37
+ Installation
38
+ ------------
39
+
40
+ Please read the [Syndi Handbook](https://github.com/syndibot/syndi/wiki/Handbook).
41
+
42
+ **Compiling from source:**
43
+
44
+ ```shell
45
+ $ git clone git://github.com/syndibot/syndi.git syndi
46
+ $ cd syndi/
47
+ ```
48
+ Use a [specific version](https://github.com/syndibot/syndi/tags):
49
+
50
+ ```shell
51
+ $ git checkout v4.0.0.alpha.1
52
+ ```
53
+
54
+ Or the cutting-edge HEAD:
55
+
56
+ ```shell
57
+ $ git checkout master
58
+ ```
59
+
60
+ ```shell
61
+ $ bundle install
62
+ $ rake
63
+ $ rake install
64
+ ```
65
+
66
+ Syndi is currently known to function on these operating systems:
67
+
68
+ + Microsoft Windows
69
+ + Mac OS X
70
+ + Linux
71
+ + BSD flavors
72
+
73
+ Using these Ruby virtual machines:
74
+
75
+ + MRI/YARV (official) 2.0.0
76
+
77
+ Support
78
+ -------
79
+
80
+ If you should find yourself in need of support, please foremost consult with the
81
+ documentation on the [wiki](https://github.com/syndibot/syndi/wiki).
82
+
83
+ If the wiki fails to address your needs, please either:
84
+
85
+ 1. Post to the [syndibot](https://groups.google.com/group/syndibot)
86
+ group under the _support_ category, **or**
87
+ 2. Join the official IRC chatroom at
88
+ [#syndi on irc.freenode.net](http://webchat.freenode.net/?randomnick=1&channels=#syndi&prompt=1)
89
+
90
+ **Bugs** should be reported on the [issue management hub](https://github.com/syndibot/syndi/issues).
91
+
92
+ Authors
93
+ -------
94
+
95
+ Syndi 4 was rewritten from scratch by Autumn Perrault (noxgirl) in Ruby and C,
96
+ and is actively developed by the core team.
97
+
98
+ Legal
99
+ -----
100
+
101
+ Copyright (c) 2009-2013, Autumn Perrault. All rights reserved.
102
+
103
+ Syndi is free, open-source software, distributed per the terms of the two-clause
104
+ ("FreeBSD") license, the full terms of which are in [**LICENSE**](LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ # Copyright (c) 2013, Autumn Perrault, et al. All rights reserved.
2
+ # This free software is distributed under the FreeBSD license (see LICENSE).
3
+
4
+ # import the gemspec
5
+ GEMSPEC = 'syndi.gemspec'
6
+ $gemspec ||= eval(File.read(GEMSPEC), binding, GEMSPEC)
7
+
8
+ def perform t
9
+ Rake::Task[t].invoke
10
+ end
11
+
12
+ # Directives for Ruby Make (rake)
13
+ # to test/compile Syndi 4, and optionally
14
+ # push to RubyGems
15
+
16
+ # load all of the tasks
17
+ Dir["tasks/**/*.rake"].each do |t|
18
+ load File.expand_path t
19
+ end
20
+
21
+ # groups
22
+ if ENV['CI']
23
+ task :default => %i[compile spec]
24
+ else
25
+ task :default => %i[compile native gem]
26
+ end
27
+ task :typical => %i[compile spec]
28
+ task :full => %i[clean typical gem install]
29
+
30
+ # vim: set ts=4 sts=2 sw=2 et:
data/WINDOWS.md ADDED
@@ -0,0 +1,64 @@
1
+ Syndi on Windows
2
+ ===============
3
+
4
+ Yay
5
+ ---
6
+
7
+ Syndi 4.0 _Phoenix_ brings back something which hasn't existed since version 1.0:
8
+ support for Microsoft Windows!
9
+
10
+ This is because we have prioritized programming v4.0 with platform independence
11
+ from its inception.
12
+
13
+ How It Works
14
+ ------------
15
+
16
+ Windows users can install Syndi easily by downloading and installing from RubyGems:
17
+
18
+ $ gem install Syndi [--pre]
19
+
20
+ On Windows, this will install the native Windows distribution, which includes the
21
+ _csyndi_ library cross-compiled with [Minimalist GNU for Windows](http://www.mingw.org/),
22
+ commonly called MinGW.
23
+
24
+ This assumes that you have installed Ruby compiled with MinGW; this is the case
25
+ if you used [RubyInstaller for Windows](http://rubyinstaller.org/).
26
+
27
+ Compiling
28
+ ---------
29
+
30
+ Users who have good cause for doing so are also welcome to compile the source
31
+ for Syndi themselves.
32
+
33
+ We should hope that [DevKit](http://rubyinstaller.org/downloads) will provide
34
+ a sufficiently sane build environment for this on Windows. We haven't tested
35
+ it since we cross-compile on UNIX systems when packaging gems.
36
+
37
+ You must then force RubyGems to download the distribution without binaries, so
38
+ that _csyndi_ will be compiled:
39
+
40
+ $ gem install Syndi [--pre] --platform=ruby --development
41
+
42
+ Cross-compiling
43
+ ---------------
44
+
45
+ You must have a cross-compiling toolset installed on your system. Install the
46
+ MinGW toolset.
47
+
48
+ On Arch Linux, this can be installed with:
49
+
50
+ # pacman -Syu mingw32-gcc mingw32-pthreads
51
+
52
+ Then configure rake-compiler:
53
+
54
+ $ rake-compiler cross-ruby VERSION=1.9.3-p362
55
+
56
+ Now compile the source code for Windows:
57
+
58
+ $ rake cross compile
59
+
60
+ Package the native distribution gem:
61
+
62
+ $ rake cross native gem
63
+
64
+ _Et voila!_ You should find the native gem in `pkg/`.
data/bin/syndi ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (c) 2013, Autumn Perrault, et al. All rights reserved.
3
+ # This free software is distributed under the FreeBSD license (see LICENSE).
4
+
5
+ require 'English'
6
+ require 'rbconfig'
7
+
8
+ # Perform a check of the Ruby version.
9
+ if ::RbConfig::CONFIG['ruby_version'] < '2.0.0'
10
+ puts 'Syndi requires Ruby v2.0.0 or later. Please read the Syndi Handbook.'
11
+ exit 1
12
+ end
13
+
14
+ # Forbid root.
15
+ if ENV.include? 'USER'
16
+ if ENV['USER'] == 'root'
17
+ puts 'It is forbidden to run Syndi as the root user!'
18
+ exit 1
19
+ end
20
+ end
21
+
22
+ # Import necessary libraries.
23
+ require 'slop'
24
+ # Import system Syndi libraries, or fall back to internal ones.
25
+ begin
26
+ require 'syndi'
27
+ rescue LoadError
28
+ $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
29
+ require 'syndi'
30
+ end
31
+ require 'syndi/verbosity'
32
+
33
+ # Change to the Syndi directory.
34
+ SYNDI_DIR = File.join ENV['HOME'], '.syndi'
35
+ Dir.mkdir SYNDI_DIR unless Dir.exists? SYNDI_DIR
36
+ Dir.chdir SYNDI_DIR
37
+
38
+ $VERBOSITY = 0
39
+
40
+ # Parse options.
41
+ opts = Slop.parse(:banner => "Usage: #$PROGRAM_NAME [options]") do
42
+ on :h, :help, "You're looking at it." do
43
+ puts self
44
+ exit 0
45
+ end
46
+
47
+ on :v, :version, 'Display version and exit.' do
48
+ puts <<-EOV
49
+ Syndi #{Syndi::FULLVERSION}
50
+ [os: #{::RbConfig::CONFIG['host_os']}] [rb: #{::RbConfig::CONFIG['ruby_version']}] [arch: #{::RbConfig::CONFIG['arch']}]
51
+
52
+ http://syndibot.com
53
+ EOV
54
+ exit 0
55
+ end
56
+
57
+ on(:f, :foreground, 'Disable automatic daemonizing.')
58
+ on(:c, :conf=, 'Specify a particular configuration file.')
59
+ on(:V, :verbose, 'Increase verbosity of output (more uses, the more verbose).') { $VERBOSITY += 1 }
60
+ end
61
+
62
+ # Begin start up.
63
+ puts "* Syndi #{Syndi::VERSION} starting...".bold
64
+ $log = Syndi::Logger.new
65
+
66
+ # Create an instance of Syndi.
67
+ begin
68
+ $m = Syndi::Bot.new opts
69
+ status = $m.init
70
+ rescue => e
71
+ $log.fatal "An initialization error occurred: #{e}"
72
+ end
73
+
74
+ # Check our status.
75
+ if status
76
+ time = Time.now
77
+ $log.info "Syndi started at #{time}."
78
+ else
79
+ $log.fatal "Initialization inexplicably failed."
80
+ end
81
+ STARTTIME = time.freeze
82
+
83
+ # We survived? We survived! Fork into the background if not in debug or foreground.
84
+ $m.daemonize if !opts.foreground? && $VERBOSITY < 1
85
+
86
+ # Signals
87
+ sig = {
88
+ 'TERM' => proc { $m.terminate('Caught termination signal') },
89
+ 'INT' => proc { $m.terminate('Ctrl-C pressed') },
90
+ 'HUP' => proc { $m.conf.rehash }
91
+ }
92
+ sig.delete 'HUP' if Syndi.windows?
93
+ sig.each { |signal, prc| Signal.trap(signal) { prc.call } }
94
+
95
+ begin
96
+ $m.start
97
+ rescue => e
98
+ $log.error_bt "Fatal exception: #{e}", e.backtrace
99
+ exit 1
100
+ end
101
+
102
+ # vim: set ts=4 sts=2 sw=2 et:
data/bin/syndi-conf ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (c) 2013, Autumn Perrault, et al. All rights reserved.
3
+ # This free software is distributed under the FreeBSD license (see LICENSE).
4
+
5
+ require 'slop'
6
+
7
+ # Check whether we're installed as a gem or a standalone
8
+ unless File.expand_path(__FILE__) =~ /^#{Regexp.escape File.join(Dir.home, '.gem')}/
9
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) # Add the Syndi libraries to LOAD_PATH
10
+ end
11
+
12
+ require 'syndi/configure'
13
+
14
+ # Parse options.
15
+ opts = Slop.parse(:banner => "Usage: #$0 [options/command]") do
16
+
17
+ on :h, :help, 'Display this help message.' do
18
+ puts self
19
+ exit 0
20
+ end
21
+
22
+ on :v, :version, 'Display version.' do
23
+ puts <<-EOV
24
+ Syndi Configure v#{Syndi::Configure::VERSION}
25
+
26
+ http://syndibot.com
27
+ EOV
28
+ exit 0
29
+ end
30
+
31
+ # configuration generator
32
+ command :gen do
33
+ run do |_, _|
34
+ Syndi::Configure::Generator.new.generate
35
+ end
36
+ end
37
+
38
+ # configuration editor
39
+ command :edit do
40
+ run do |_, args|
41
+ Syndi::Configure::CLI.start(args)
42
+ end
43
+ end
44
+
45
+ end
46
+
47
+ # vim: set ts=4 sts=2 sw=2 et:
data/conf/example.yml ADDED
@@ -0,0 +1,101 @@
1
+ ---
2
+
3
+ # Syndi 4 example YAML configuration file
4
+
5
+ # Core libraries to load.
6
+ #
7
+ # irc: IRC protocol framework.
8
+ libraries:
9
+ - irc
10
+
11
+ # List of IRC servers to which to connect.
12
+ irc:
13
+ # Server name, followed by properties.
14
+ freenode:
15
+
16
+ # Server address.
17
+ address: irc.freenode.net
18
+
19
+ # Server port.
20
+ port: 7000
21
+
22
+ # Whether to use SSL: true or false.
23
+ useSSL: true
24
+
25
+ # Nicknames. Syndi will use the first one, and if it fails, it will try
26
+ # each one until success is achieved.
27
+ nickname:
28
+ - moobot
29
+ - altnick
30
+
31
+ # Username or ident.
32
+ username: Syndi
33
+
34
+ # Real name or GECOS.
35
+ realName: Syndi
36
+
37
+ # SASL options. Remove this if you don't want to use SASL or the server
38
+ # does not support it.
39
+ SASL:
40
+ # Timeout in seconds. 15s is reasonable.
41
+ timeout: 15
42
+ # Account as which to identify.
43
+ username: moobot
44
+ # Password for the account.
45
+ password: moopass
46
+
47
+ # List of channels to join automatically.
48
+ syndijoin:
49
+ - name: '#syndi-bots' # The channel name. Don't forget the quotes because channels have octothorpes.
50
+ key: ~ # Key, if necessary.
51
+
52
+ # Another server. Add as many as you wish.
53
+ Rizon:
54
+
55
+ address: irc.rizon.net
56
+ port: 6667
57
+ useSSL: false
58
+ nickname:
59
+ - moobot
60
+ - altnick
61
+ username: Syndi
62
+ realName: Syndi
63
+
64
+ # Identify the traditional way; that is, by privately messaging a service.
65
+ nickIdentify:
66
+ # The name of the service--usually NickServ.
67
+ service: NickServ
68
+ # The command to use--usually identify.
69
+ command: identify
70
+ # The password to use. If the server uses Atheme, we suggest putting the accountname followed by
71
+ # the password here, so that identification never fails.
72
+ password: moopass
73
+
74
+ # Database configuration
75
+ #
76
+ # Syndi uses Redis for its database management, because it is the system we
77
+ # thought most apropos to our minimalist philosophy.
78
+ #
79
+ # There is a wiki page on this: https://github.com/Syndi/Syndi/wiki/Setting-Up-a-Database
80
+ #
81
+ # All of these are commented because the defaults are typically desirable.
82
+ database:
83
+
84
+ # This will disable database functionality. We discourage this.
85
+ #disable: yes
86
+
87
+ # If your Redis server is listening on a host other than the 'localhost'
88
+ # default, specify it here.
89
+ #address: '10.0.1.1'
90
+
91
+ # If it is listening on a port other than 6379, specify it here.
92
+ #port: 6500
93
+
94
+ # If it is using a UNIX socket, provide the path here.
95
+ #path: '/tmp/redis.sock'
96
+
97
+ # If a password is required, specify it here.
98
+ #password: insecurepassword123
99
+
100
+ # To use a different database from the default (0), specify its number here.
101
+ #number: 10