joggle 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/COPYING ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2009 Paul Duncan <pabs@pablotron.org>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies of the Software, its documentation and marketing & publicity
12
+ materials, and acknowledgment shall be given in the documentation, materials
13
+ and software packages that this Software was used.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,212 @@
1
+ Joggle 0.1.0 README
2
+ ===================
3
+
4
+ Please see the file COPYING for licensing and warranty information. The
5
+ latest version of this software is available at the following URL:
6
+
7
+ http://pablotron.org/software/joggle/
8
+
9
+ Table of Contents
10
+ =================
11
+ 1. Overview
12
+ 2. System Requirements
13
+ 3. Installation
14
+ 4. Configuration
15
+ 5. Using Joggle
16
+ 6. Advanced Configuration
17
+ 7. Security Considerations
18
+ 8. Reporting Bugs
19
+ 9. About the Author
20
+
21
+ 1. Overview
22
+ ===========
23
+ Joggle is an Twitter to XMPP relay. Jabber messages are sent as tweets,
24
+ and tweets are sent as instant messages.
25
+
26
+ Installation and configuration is easy and, if you'd like, you can share
27
+ your Joggle installation with more than one person.
28
+
29
+ 2. System Requirements
30
+ ======================
31
+ Here's what you'll need to get started using Joggle:
32
+
33
+ * Ruby 1.8 (a recent version, preferrably including RubyGems)
34
+ * JSON (gem install json)
35
+ * XMPP4r (gem install xmpp4r)
36
+
37
+ You'll also need a spare Jabber account to relay messages. If you don't
38
+ have your own Jabber server, you can create a free one through
39
+ jabber.org or gmail.com.
40
+
41
+ 3. Installation
42
+ ===============
43
+ The easiest way to install Joggle is via RubyGems:
44
+
45
+ sudo gem install joggle
46
+
47
+ If you don't use RubyGems, you can also install Joggle using setup.rb,
48
+ like this:
49
+
50
+ sudo ruby ./setup.rb
51
+
52
+ Note: If you're using Debian or a Debian-based distribution (e.g.
53
+ Ubuntu), then you'll want to use the RubyGems version of XMPP4r -- the
54
+ Debian version is horribly out of date, and may not work with Joggle.
55
+
56
+ 4. Configuration
57
+ ================
58
+ The simplest way to get Joggle up and running is like so:
59
+
60
+ # create ~/.joggle and make sure it's only readable by you
61
+ mkdir ~/.joggle && chmod 700 ~/.joggle
62
+
63
+ # add username and password to config
64
+ cp doc/joggle.cfg.sample ~/.joggle/joggle.cfg
65
+
66
+ # edit ~/.joggle/joggle.cfg and add your jabber username and
67
+ # password!
68
+ vim ~/.joggle/joggle.cfg
69
+
70
+ # run joggle
71
+ joggle --config ~/.joggle/joggle.cfg
72
+
73
+ Want to run Joggle via Cron? Here's how:
74
+
75
+ # run joggle every time the system is restarted
76
+ @reboot joggle --daemon --config ~/.joggle/joggle.cfg
77
+
78
+ Note: Although you can specify the JID and password via the command-line
79
+ or the environment, doing so is not recommended on a shared system; see
80
+ the "Security Considerations" section below for additional information.
81
+
82
+ 5. Using Joggle
83
+ ===============
84
+ In order to use Joggle you'll need to bind your Jabber account to your
85
+ twitter account. Here's how:
86
+
87
+ 1. Add the Joggle Jabber ID to your IM client. Joggle will
88
+ automatically accept any subscription.
89
+
90
+ 2. Register your Twitter account with Joggle by sending a
91
+ message to Joggle in the following form:
92
+
93
+ ".register TWITTER_USER TWITTER_PASS"
94
+
95
+ (replace TWITTER_USER and TWITTER_PASS with your Twitter username
96
+ and password, respectively)
97
+
98
+ Note that more than one person can use the Joggle Jabber relay. Each
99
+ person just needs to follow the steps above to bind their Jabber and
100
+ Twitter accounts (this feature can be disabled; see the "Advanced
101
+ Configuration" section below). At the moment you can only register one
102
+ Twitter account per person, although this may change in the future.
103
+
104
+ If you change your mind and decide not to use Joggle any more, you can
105
+ tell it to forget your Twitter account information by sending a message
106
+ like this:
107
+
108
+ ".unregister"
109
+
110
+ There are several other commands available via message as well; use the
111
+ ".help" command for a complete list.
112
+
113
+ 6. Advanced Configuration
114
+ =========================
115
+ By default, Joggle will automatically approve any Jabber subscription
116
+ request it receives. This means that if Joggle is relaying via an
117
+ account on a public Jabber server, then anyone can use your Joggle
118
+ installation to relay to Twitter.
119
+
120
+ To limit your Joggle installation to a specific set of Jabber IDs,
121
+ use the --allow command-line option, like so:
122
+
123
+ # limit joggle access to specific users
124
+ joggle --allow alice@example.com --allow bob@example.com
125
+
126
+ Or you can use the 'engine.allow' directive in the configuration file:
127
+
128
+ # limit access to alice@example.com and bob@example.com
129
+ engine.allow alice@example.com
130
+ engine.allow bob@example.com
131
+
132
+ You can also configure the Joggle update frequency. Here's what the
133
+ configuration looks like by default:
134
+
135
+ # from 8am until 3pm, update every 10 minutes
136
+ engine.update.range 8-15 10
137
+
138
+ # from 3pm until 10pm, update every 5 minutes
139
+ engine.update.range 15-22 10
140
+
141
+ # from 10pm until midnight, update every 10 minutes
142
+ engine.update.range 22-24 10
143
+
144
+ # from midnight until 2am, update every 20 minutes
145
+ engine.update.range 0-2 20
146
+
147
+ # for unspecified times (e.g. 2am - 8am), update every 60 minutes
148
+ engine.update.default 60
149
+
150
+ Note that the _minimum_ update frequency is 5 minutes; Joggle will
151
+ ignore anything less than that. Also note that HTTP caching and a
152
+ number of other checks are performed prior to contacting Twitter, so
153
+ the specified update frequency will probably not translate precisely
154
+ into the actual update frequency.
155
+
156
+ There are several other command-line options, environment varialbes, and
157
+ configuration file directives. These will be documented on the Joggle
158
+ web site (http://pablotron.org/software/joggle/) when time permits.
159
+
160
+ 7. Security Considerations
161
+ ==========================
162
+ Since Joggle is saves your Twitter username and password, an unsavory
163
+ system administrator or malicious user could obtain both by sifting
164
+ through the Joggle storage or log files.
165
+
166
+ By default, Joggle does its best to protect against malicious users by
167
+ creating the storage and log files in a directory that only accessible
168
+ by the owner (chmod 700).
169
+
170
+ The implications here are as follows:
171
+
172
+ * Don't use a Joggle relay run by someone you don't trust.
173
+
174
+ * Don't run a Joggle relay on a system that isn't secure.
175
+
176
+ * Don't change the path for the configuration, storage, or log files,
177
+ without properly securing the new location (e.g. chmod 700).
178
+
179
+ * Don't specify the username and password via the command-line on a
180
+ shared system, since the command-line arguments can be viewed by
181
+ other users (e.g. "ps axu")
182
+
183
+ You should also be wary of your Jabber providers; many Jabber servers of
184
+ them do not configure Jabber with TLS or SASL enabled, which means that
185
+ both your Jabber and Twitter credentials are sent over the wire as plain
186
+ text.
187
+
188
+ Joggle connects to Twitter via SSL. If you're having problems with SSL,
189
+ you can disable this feature by adding the following directives to your
190
+ config file:
191
+
192
+ # use http instead of https for Twitter updates
193
+ # (do not do this unless you have to)
194
+ twitter.fetcher.url.timeline http://twitter.com/statuses/friends_timeline.json
195
+ twitter.fetcher.url.tweet http://twitter.com/statuses/update.json
196
+
197
+ Note that doing this is NOT RECOMMENDED; your Twitter username and
198
+ password will be sent over the wire as plain text.
199
+
200
+ 8. Reporting Bugs
201
+ =================
202
+ To report a bug or request a feature, visit the Joggle Redmine
203
+ repository at the following URL:
204
+
205
+ http://redmine.pablotron.org/projects/show/joggle
206
+
207
+ You can also contact me directly via email using the address below.
208
+
209
+ 9. About the Author
210
+ ===================
211
+ Paul Duncan <pabs@pablotron.org>
212
+ http://pablotron.org/
data/Rakefile ADDED
@@ -0,0 +1,120 @@
1
+
2
+ # load libraries
3
+
4
+ require 'rake/rdoctask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'lib/joggle/version.rb'
8
+
9
+ def package_info
10
+ require 'ostruct'
11
+ require 'rubygems'
12
+
13
+ # create package
14
+ ret = OpenStruct.new
15
+
16
+ # set package information
17
+ ret.name = 'Joggle'
18
+ ret.blurb = 'Jabber/Twitter relay, written in Ruby.'
19
+ ret.version = Joggle::VERSION
20
+ ret.platform = Gem::Platform::RUBY
21
+ ret.url = 'http://pablotron.org/software/joggle/'
22
+
23
+ # author information
24
+ ret.author_name = 'Paul Duncan'
25
+ ret.author_email = 'pabs@pablotron.org'
26
+
27
+ # requirements and files
28
+ ret.reqs = ['none']
29
+ ret.include_files = Dir['**/*'].delete_if { |path|
30
+ %w{CVS .svn .hg}.any? { |chunk| path.include?(chunk) }
31
+ }
32
+
33
+ # rdoc info
34
+ ret.rdoc_title = "#{ret.name} #{ret.version} API Documentation"
35
+ ret.rdoc_options = %w{--webcvs http://hg.pablotron.org/joggle}
36
+ ret.rdoc_dir = 'doc'
37
+ ret.rdoc_files = %w{bin/joggle lib/**/*.rb README examples/**/*}
38
+
39
+ # runtime info
40
+ ret.auto_require = 'joggle'
41
+ ret.executables = %w{joggle}
42
+ ret.require_path = 'lib'
43
+ ret.package_name = 'joggle'
44
+ ret.dependencies = %w{xmpp4r json}
45
+
46
+ # package signing
47
+ if false && ENV['GEM_SIGNING_KEY'] && ENV['GEM_SIGNING_CHAIN']
48
+ ret.signing_key = File.expand_path(ENV['GEM_SIGNING_KEY'])
49
+ ret.signing_chain = ENV['GEM_SIGNING_CHAIN'].split(',').map { |path|
50
+ File.expand_path(path)
51
+ }
52
+ end
53
+
54
+ # package release dir
55
+ if path = ENV['RAKE_PACKAGE_DIR']
56
+ ret.pkg_dir = File.join(File.expand_path(path), ret.package_name)
57
+ end
58
+
59
+ if files = ret.rdoc_files
60
+ ret.rdoc_files = files.map { |e| Dir.glob(e) }.flatten.compact
61
+ end
62
+
63
+ # return package
64
+ ret
65
+ end
66
+
67
+ pkg = package_info
68
+
69
+ gem_spec = Gem::Specification.new do |s|
70
+ # package information
71
+ s.name = pkg.name.downcase
72
+ s.platform = pkg.platform
73
+ s.version = pkg.version
74
+ s.summary = s.description = pkg.blurb
75
+ s.rubyforge_project = 'pablotron'
76
+
77
+ # files
78
+ pkg.reqs.each { |req| s.requirements << req }
79
+ s.files = pkg.include_files
80
+
81
+ # runtime info
82
+ s.executables = pkg.executables
83
+ s.require_path = pkg.require_path
84
+ s.autorequire = pkg.auto_require
85
+
86
+ # dependencies
87
+ pkg.dependencies.each { |dep| s.add_dependency(dep) }
88
+
89
+ # rdoc info
90
+ s.has_rdoc = true
91
+ s.rdoc_options = ['--title', pkg.rdoc_title] + pkg.rdoc_options + pkg.rdoc_files
92
+
93
+ # author and project details
94
+ s.author = pkg.author_name
95
+ s.email = pkg.author_email
96
+ s.homepage = pkg.url
97
+
98
+ # gem crypto stuff
99
+ if pkg.signing_key && pkg.signing_chain
100
+ s.signing_key = pkg.signing_key
101
+ s.signing_chain = pkg.signing_chain
102
+ end
103
+ end
104
+
105
+ Rake::GemPackageTask.new(gem_spec) do |p|
106
+ p.need_tar_gz = true
107
+ # p.need_pgp_signature = true
108
+ p.package_dir = pkg.pkg_dir if pkg.pkg_dir
109
+ end
110
+
111
+
112
+ Rake::RDocTask.new do |rd|
113
+ rd.title = pkg.rdoc_title
114
+ rd.rdoc_dir = pkg.rdoc_dir
115
+ rd.rdoc_files.include(*pkg.rdoc_files)
116
+ rd.options.concat(pkg.rdoc_options)
117
+ end
118
+
119
+ task :clean => [:clobber]
120
+ task :release => [:clean, :package]
data/TODO ADDED
@@ -0,0 +1,36 @@
1
+ Release
2
+ -------
3
+ [x] new name, jitter is used too much (-> joggle)
4
+ [x] remove lib/joggle/monitor/{socket,jabber}.rb (unused)
5
+ [x] remove /tmp/foo debugging
6
+ [x] help text
7
+ [x] add new tweets to message store (so they don't show up on updates)
8
+ [x] cli tool and option parsing (bin/joggle)
9
+ [x] rdoc documentation
10
+ [x] add client-side support for restricted user list
11
+ [x] remove /resource bit from jid
12
+ [x] gem
13
+ [x] finish README
14
+ [x] check length of message before trying to submit it
15
+
16
+ Next
17
+ ----
18
+ [ ] in_response_to (check time of last response for @messages?)
19
+ [ ] .reply option
20
+ [-] better error handling for 404s
21
+ [ ] handle rate limiting (add Throttle and message queue?)
22
+ [ ] .set option (to configure sleep, etc)
23
+
24
+ Maybe
25
+ -----
26
+ [ ] handle client disconnects
27
+ [ ] fix http caching (give count to twitter)
28
+ [ ] redirect jabber client output to log file
29
+
30
+ Future
31
+ ------
32
+ [ ] http proxy for post
33
+ [ ] add additional backends (sqlite3, at least)
34
+ [ ] make config directives relative to config path
35
+ [ ] add support for jabber auto-registration?
36
+ [ ] ignoring specifc jabber users
data/bin/joggle ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'joggle/cli/runner'
4
+
5
+ # create and run joggle cli interface
6
+ Joggle::CLI::Runner.run($0, ARGV)