tkellem 0.7.1 → 0.8.0

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.
Files changed (44) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +4 -0
  3. data/README.md +28 -6
  4. data/Rakefile +14 -5
  5. data/bin/tkellem +2 -107
  6. data/debian/changelog +5 -0
  7. data/debian/compat +1 -0
  8. data/debian/control +18 -0
  9. data/debian/copyright +42 -0
  10. data/debian/docs +1 -0
  11. data/debian/examples +1 -0
  12. data/debian/install +3 -0
  13. data/debian/manpages +1 -0
  14. data/debian/rules +13 -0
  15. data/debian/source/format +1 -0
  16. data/debian/tkellem.1 +11 -0
  17. data/examples/config.yml +2 -29
  18. data/lib/tkellem/bouncer.rb +196 -31
  19. data/lib/tkellem/bouncer_connection.rb +90 -85
  20. data/lib/tkellem/daemon.rb +155 -0
  21. data/lib/tkellem/irc_message.rb +58 -0
  22. data/lib/tkellem/irc_server.rb +8 -121
  23. data/lib/tkellem/migrations/001_init_db.rb +33 -0
  24. data/lib/tkellem/models/host.rb +11 -0
  25. data/lib/tkellem/models/listen_address.rb +12 -0
  26. data/lib/tkellem/models/network.rb +15 -0
  27. data/lib/tkellem/models/network_user.rb +12 -0
  28. data/lib/tkellem/models/user.rb +56 -0
  29. data/lib/tkellem/plugins/backlog.rb +160 -0
  30. data/lib/tkellem/plugins/push_service.rb +152 -0
  31. data/lib/tkellem/socket_server.rb +29 -0
  32. data/lib/tkellem/tkellem_bot.rb +318 -0
  33. data/lib/tkellem/tkellem_server.rb +114 -0
  34. data/lib/tkellem/version.rb +3 -0
  35. data/lib/tkellem.rb +7 -10
  36. data/resources/bot_command_descriptions.yml +36 -0
  37. data/spec/irc_message_spec.rb +47 -0
  38. data/spec/irc_server_spec.rb +60 -0
  39. data/spec/spec_helper.rb +0 -2
  40. data/tkellem.gemspec +20 -47
  41. metadata +118 -22
  42. data/VERSION +0 -1
  43. data/lib/tkellem/backlog.rb +0 -85
  44. data/lib/tkellem/irc_line.rb +0 -58
@@ -1,58 +0,0 @@
1
- module Tkellem
2
-
3
- class IrcLine
4
- RE = %r{(:[^ ]+ )?([^ ]*)(.*)}i
5
-
6
- def self.parse(line)
7
- md = RE.match(line) or raise("invalid input: #{line.inspect}")
8
-
9
- self.new(line, md[1], md[2], md[3])
10
- end
11
-
12
- attr_reader :prefix, :command, :args
13
-
14
- def initialize(orig, prefix, command, args)
15
- @orig = orig
16
- @prefix = prefix ? prefix.strip : nil
17
- @command = command
18
-
19
- args.strip!
20
- idx = args.index(":")
21
- if idx
22
- @args = args[0...idx].split(' ') + [args[idx+1..-1]]
23
- else
24
- @args = args.split(' ')
25
- end
26
- end
27
-
28
- def command?(cmd)
29
- @command.downcase == cmd.downcase
30
- end
31
-
32
- def replay
33
- @orig
34
- end
35
- alias_method :to_s, :replay
36
-
37
- def last
38
- args.last
39
- end
40
-
41
- def target_user
42
- if prefix && md = %r{^:([^!]+)}.match(prefix)
43
- md[1]
44
- else
45
- nil
46
- end
47
- end
48
-
49
- def with_timestamp(timestamp)
50
- new_command = [prefix, command]
51
- new_command += args[0..-2]
52
- new_command.push("#{timestamp.strftime("%H:%M:%S")}> #{args.last}")
53
- new_command.join(' ')
54
- end
55
-
56
- end
57
-
58
- end