rubeechat 0.1.2 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # vim:ft=ruby
@@ -3,7 +3,6 @@
3
3
  require 'optparse'
4
4
  require 'fileutils'
5
5
 
6
- RUBEECHAT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) unless defined?(RUBEECHAT_ROOT)
7
6
 
8
7
  module Rubeechat
9
8
  class Installer
@@ -26,8 +25,9 @@ Options:
26
25
  end
27
26
 
28
27
  def initialize
28
+ @rubeechat_root = File.expand_path('../..', __FILE__)
29
29
  @plugins_dir = File.expand_path('~/.weechat/ruby')
30
- @plugins = Dir[File.join(RUBEECHAT_ROOT, 'plugins', '*.rb')]
30
+ @plugins = Dir[File.join(@rubeechat_root, 'plugins', '*.rb')]
31
31
  @force = false
32
32
  end
33
33
 
@@ -1,11 +1,18 @@
1
- RUBEECHAT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
1
+ module Rubeechat
2
+ @@root = File.expand_path('../..', __FILE__) unless defined?(@@root)
2
3
 
3
- $LOAD_PATH.unshift(File.join(RUBEECHAT_ROOT, 'lib'))
4
- $LOAD_PATH.uniq!
4
+ def self.root
5
+ @@root
6
+ end
5
7
 
6
- module Rubeechat
8
+ def self.root=(v)
9
+ @@root = v
10
+ end
7
11
  end
8
12
 
13
+ $LOAD_PATH.unshift(File.join(Rubeechat.root, 'lib'))
14
+ $LOAD_PATH.uniq!
15
+
9
16
  require 'rubeechat/info_list'
10
17
  require 'rubeechat/privmsg'
11
18
  require 'rubeechat/config'
@@ -22,6 +22,10 @@ module Rubeechat
22
22
  current_buffer == 1
23
23
  end
24
24
 
25
+ def command(str)
26
+ Weechat.command(@p, str)
27
+ end
28
+
25
29
  private
26
30
  def method_missing(name, *a, &b)
27
31
  name = name.to_sym
@@ -0,0 +1,4 @@
1
+ module Rubeechat
2
+ VERSION = '0.8.1'
3
+ end
4
+
@@ -277,7 +277,8 @@ require 'logger'
277
277
  require 'ostruct'
278
278
 
279
279
  require 'rubygems'
280
- require 'ruby-debug'
280
+
281
+ # require 'ruby-debug'
281
282
 
282
283
  # Debugger.start_remote('127.0.0.1', [Debugger::PORT, Debugger::PORT + 1], false) do
283
284
  # # load initrc script
@@ -363,7 +364,7 @@ def weechat_destructor
363
364
  end
364
365
 
365
366
  def weechat_init
366
- Weechat.register('growler', 'slyphon', '0.1', 'GPL3', 'Growl notify when mentioned', 'weechat_destructor', '')
367
+ Weechat.register('growler', 'slyphon', '0.2', 'GPL3', 'Growl notify when mentioned', 'weechat_destructor', '')
367
368
  Weechat.hook_signal('*,irc_in_PRIVMSG', 'privmsg_cb', '')
368
369
  Weechat.hook_command('growl', 'control the growler', ARG_FORM, ARG_INFO, '', 'growl_cmd', '')
369
370
 
@@ -1,4 +1,5 @@
1
1
  require 'rubygems'
2
+ gem 'rubeechat'
2
3
  require 'rubeechat'
3
4
 
4
5
  require 'logger'
@@ -126,8 +127,8 @@ def open_url(buffer, i=nil)
126
127
  url = i.nil? ? buffer.current_url : buffer.urls[i]
127
128
 
128
129
  if url
129
- cmd = Rubeechat::Config['command'] % [url]
130
- system(cmd)
130
+ cmd = Rubeechat::Config['command']
131
+ system(cmd, url)
131
132
  else
132
133
  msg = i.nil? ? "url ring empty" : "no url # #{i} for buffer #{buffer.name}"
133
134
  buffer.print("urlopen: #{msg}")
@@ -152,6 +153,8 @@ def open_cmd(data, buf_ptr, args)
152
153
  when 'set-command'
153
154
  Rubeechat::Config['command'] = args
154
155
  buf.print("urlopen: command is now #{args}")
156
+ when 'show-command'
157
+ buf.print("open command is: #{Rubeechat::Config['command'].inspect}")
155
158
  when 'clear'
156
159
  buf.urls.clear
157
160
  buf.print("urlopen: cleared url list")
@@ -0,0 +1,62 @@
1
+ require 'rubygems'
2
+ require 'rubeechat'
3
+
4
+ require 'logger'
5
+ require 'ostruct'
6
+
7
+ ## start remote debugger
8
+
9
+ require 'rubygems'
10
+ require 'ruby-debug'
11
+
12
+ Debugger.start_remote('127.0.0.1', [Debugger::PORT, Debugger::PORT + 1], false) do
13
+ # load initrc script
14
+ Debugger.run_init_script(StringIO.new)
15
+ end
16
+
17
+ L = Logger.new('/tmp/znc-backlog-filter.log')
18
+ L.level = Logger::DEBUG
19
+
20
+
21
+ def signal_cb(_, signal, signal_data)
22
+ p = Rubeechat::Privmsg.parse(signal, signal_data)
23
+
24
+ if p.nick =~ /^[*]{3}!znc@znc\.in$/
25
+ if p.message == 'Buffer Playback...'
26
+ L.debug { "disabling log for playback for buffer: #{p.buffer_name}" }
27
+ p.buffer.command("/logger disable")
28
+ elsif p.message == 'Playback Complete.'
29
+ L.debug { "re-enabling log for buffer: #{p.buffer_name}" }
30
+ p.buffer.command("/logger set 9")
31
+ end
32
+ end
33
+
34
+ ok
35
+ end
36
+
37
+ def ok; Weechat::WEECHAT_RC_OK; end
38
+
39
+ def znc_log_cmd(_, buf_ptr, args)
40
+ debugger
41
+ end
42
+
43
+ def weechat_destructor
44
+ L.close
45
+ ok
46
+ end
47
+
48
+ DEFAULT_OPTS = {}
49
+
50
+ def weechat_init
51
+ Weechat.register('znc-backlog-filter', 'slyphon', '0.1', 'GPL3', "don't log playback from znc", 'weechat_destructor', '')
52
+ Weechat.hook_signal('*,irc_in_PRIVMSG', 'signal_cb', '')
53
+
54
+ Weechat.hook_command('znc-log', 'blah', '', '', '', 'znc_log_cmd', '')
55
+
56
+ DEFAULT_OPTS.each do |k,v|
57
+ Rubeechat::Config[k] = v unless Rubeechat::Config.has_key?(k)
58
+ end
59
+
60
+ ok
61
+ end
62
+
@@ -0,0 +1,16 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "rubeechat/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'rubeechat'
6
+ s.summary = "Rubeechat: little ruby helpers for scripting WeeChat"
7
+ s.has_rdoc = true
8
+ s.authors = ['Jonathan D. Simms']
9
+ s.email = 'slyphon@gmail.com'
10
+ s.version = Rubeechat::VERSION
11
+
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ end
16
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubeechat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 61
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 8
8
9
  - 1
9
- - 2
10
- version: 0.1.2
10
+ version: 0.8.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan D. Simms
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-23 00:00:00 +00:00
19
- default_executable:
18
+ date: 2011-11-28 00:00:00 Z
20
19
  dependencies: []
21
20
 
22
21
  description:
@@ -28,16 +27,20 @@ extensions: []
28
27
  extra_rdoc_files: []
29
28
 
30
29
  files:
30
+ - .gitignore
31
+ - Gemfile
31
32
  - Rakefile
33
+ - bin/rubeechat-install-plugins
34
+ - lib/rubeechat.rb
32
35
  - lib/rubeechat/base.rb
33
36
  - lib/rubeechat/config.rb
34
37
  - lib/rubeechat/info_list.rb
35
38
  - lib/rubeechat/privmsg.rb
36
- - lib/rubeechat.rb
39
+ - lib/rubeechat/version.rb
37
40
  - plugins/growl.rb
38
41
  - plugins/urlopen.rb
39
- - bin/rubeechat-install-plugins
40
- has_rdoc: true
42
+ - plugins/znc-backlog-filter.rb
43
+ - rubeechat.gemspec
41
44
  homepage:
42
45
  licenses: []
43
46
 
@@ -67,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
70
  requirements: []
68
71
 
69
72
  rubyforge_project:
70
- rubygems_version: 1.3.7
73
+ rubygems_version: 1.8.11
71
74
  signing_key:
72
75
  specification_version: 3
73
76
  summary: "Rubeechat: little ruby helpers for scripting WeeChat"