tweet 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/bin/ttime +36 -0
  2. data/bin/tweet +30 -0
  3. data/bin/tweetd +126 -0
  4. data/doc/classes/SimplePop.html +125 -0
  5. data/doc/classes/SimplePop.src/M000009.html +59 -0
  6. data/doc/classes/SimplePop.src/M000010.html +43 -0
  7. data/doc/classes/SimplePopWindow.html +126 -0
  8. data/doc/classes/SimplePopWindow.src/M000005.html +77 -0
  9. data/doc/classes/SimplePopWindow.src/M000006.html +36 -0
  10. data/doc/classes/SyslogNotifier.html +113 -0
  11. data/doc/classes/SyslogNotifier.src/M000003.html +34 -0
  12. data/doc/classes/SyslogNotifier.src/M000004.html +39 -0
  13. data/doc/classes/Tweet/Monitor.html +236 -0
  14. data/doc/classes/Tweet/Monitor.src/M000028.html +53 -0
  15. data/doc/classes/Tweet/Monitor.src/M000029.html +38 -0
  16. data/doc/classes/Tweet/Monitor.src/M000030.html +40 -0
  17. data/doc/classes/Tweet/Monitor.src/M000031.html +31 -0
  18. data/doc/classes/Tweet/Monitor.src/M000032.html +32 -0
  19. data/doc/classes/Tweet/Monitor.src/M000033.html +65 -0
  20. data/doc/classes/Tweet/Monitor.src/M000034.html +38 -0
  21. data/doc/classes/Tweet/Note.html +272 -0
  22. data/doc/classes/Tweet/Note.src/M000020.html +32 -0
  23. data/doc/classes/Tweet/Note.src/M000021.html +30 -0
  24. data/doc/classes/Tweet/Note.src/M000022.html +30 -0
  25. data/doc/classes/Tweet/Note.src/M000023.html +30 -0
  26. data/doc/classes/Tweet/Note.src/M000024.html +30 -0
  27. data/doc/classes/Tweet/Note.src/M000025.html +30 -0
  28. data/doc/classes/Tweet/Note.src/M000026.html +30 -0
  29. data/doc/classes/Tweet/Note.src/M000027.html +30 -0
  30. data/doc/classes/Tweet/Notifier.html +147 -0
  31. data/doc/classes/Tweet/Notifier.src/M000018.html +34 -0
  32. data/doc/classes/Tweet/Notifier.src/M000019.html +30 -0
  33. data/doc/classes/Tweet.html +336 -0
  34. data/doc/classes/Tweet.src/M000011.html +42 -0
  35. data/doc/classes/Tweet.src/M000012.html +30 -0
  36. data/doc/classes/Tweet.src/M000013.html +30 -0
  37. data/doc/classes/Tweet.src/M000014.html +30 -0
  38. data/doc/classes/Tweet.src/M000015.html +30 -0
  39. data/doc/classes/Tweet.src/M000016.html +30 -0
  40. data/doc/classes/Tweet.src/M000017.html +30 -0
  41. data/doc/classes/XOSDNotifier.html +113 -0
  42. data/doc/classes/XOSDNotifier.src/M000007.html +36 -0
  43. data/doc/classes/XOSDNotifier.src/M000008.html +38 -0
  44. data/doc/created.rid +1 -0
  45. data/doc/files/README.html +228 -0
  46. data/doc/files/bin/ttime.html +112 -0
  47. data/doc/files/bin/tweet.html +111 -0
  48. data/doc/files/bin/tweetd.html +163 -0
  49. data/doc/files/bin/tweetd.src/M000001.html +51 -0
  50. data/doc/files/bin/tweetd.src/M000002.html +30 -0
  51. data/doc/files/lib/tweet_rb.html +178 -0
  52. data/doc/files/plugins/simplepop_rb.html +97 -0
  53. data/doc/files/plugins/syslog_rb.html +101 -0
  54. data/doc/files/plugins/xosd_rb.html +96 -0
  55. data/doc/fr_class_index.html +53 -0
  56. data/doc/fr_file_index.html +53 -0
  57. data/doc/fr_method_index.html +79 -0
  58. data/doc/index.html +26 -0
  59. data/doc/rdoc-style.css +175 -0
  60. data/images/comments.png +0 -0
  61. data/lib/tweet.rb +437 -0
  62. data/plugins/simplepop.rb +128 -0
  63. data/plugins/syslog.rb +24 -0
  64. data/plugins/xosd.rb +23 -0
  65. metadata +142 -0
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head><title>to_s (Tweet::Note)</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
8
+ <style>
9
+ .ruby-comment { color: green; font-style: italic }
10
+ .ruby-constant { color: #4433aa; font-weight: bold; }
11
+ .ruby-identifier { color: #222222; }
12
+ .ruby-ivar { color: #2233dd; }
13
+ .ruby-keyword { color: #3333FF; font-weight: bold }
14
+ .ruby-node { color: #777777; }
15
+ .ruby-operator { color: #111111; }
16
+ .ruby-regexp { color: #662222; }
17
+ .ruby-value { color: #662222; font-style: italic }
18
+ .kw { color: #3333FF; font-weight: bold }
19
+ .cmt { color: green; font-style: italic }
20
+ .str { color: #662222; font-style: italic }
21
+ .re { color: #662222; }
22
+ </style>
23
+ </head>
24
+ <body bgcolor="white">
25
+ <pre><span class="ruby-comment cmt"># File lib/tweet.rb, line 207</span>
26
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
27
+ <span class="ruby-ivar">@message</span>
28
+ <span class="ruby-keyword kw">end</span></pre>
29
+ </body>
30
+ </html>
@@ -0,0 +1,147 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title>Class: Tweet::Notifier</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
+ <td class="file-title"><span class="file-title-prefix">Class</span><br />Tweet::Notifier</td>
55
+ <td align="right">
56
+ <table cellspacing=0 cellpadding=2>
57
+ <tr valign="top">
58
+ <td>In:</td>
59
+ <td>
60
+ <a href="../../files/lib/tweet_rb.html">lib/tweet.rb</a>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td>Parent:</td>
65
+ <td>
66
+ Object
67
+ </td>
68
+ </tr>
69
+ </table>
70
+ </td>
71
+ </tr>
72
+ </table>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+ <div id="content">
77
+
78
+ <div class="description"><p>
79
+ Plugin-based notification mechanism. When a <a href="Note.html">Note</a> is
80
+ activated, it will call the <a
81
+ href="Notifier.html#M000019">Notifier#show</a> method for each subclass of
82
+ <a href="Notifier.html">Notifier</a>, which can be overridden to provide
83
+ whatever functionality is required.
84
+ </p>
85
+ <p>
86
+ Example of a plugin:
87
+ </p>
88
+ <pre>
89
+ class MyPlugin &lt; Tweet::Notifier
90
+ def show(e)
91
+ puts &quot;--&quot;
92
+ puts &quot;alert!! there's a message for you: #{e}&quot;
93
+ puts &quot;--&quot;
94
+ end
95
+ end
96
+ </pre>
97
+ </div>
98
+
99
+
100
+
101
+ <div class="sectiontitle">Methods</div>
102
+ <ul>
103
+ <li><a href="#M000018">inherited</a></li>
104
+ <li><a href="#M000019">show</a></li>
105
+ </ul>
106
+
107
+
108
+
109
+
110
+
111
+ <div class="sectiontitle">Attributes</div>
112
+ <table border='0' cellpadding='5'>
113
+ <tr valign='top'>
114
+ <td class='attr-rw'>
115
+ [R]
116
+ </td>
117
+ <td class='attr-name'>registered_notifiers</td>
118
+ <td class='attr-desc'></td>
119
+ </tr>
120
+ </table>
121
+
122
+ <div class="sectiontitle">Public Class methods</div>
123
+ <div class="method">
124
+ <div class="title">
125
+ <a name="M000018"></a><b>inherited</b>(sub)
126
+ [ <a href="javascript:openCode('Notifier.src/M000018.html')">source</a> ]
127
+ </div>
128
+ </div>
129
+ <div class="sectiontitle">Public Instance methods</div>
130
+ <div class="method">
131
+ <div class="title">
132
+ <a name="M000019"></a><b>show</b>(note)
133
+ [ <a href="javascript:openCode('Notifier.src/M000019.html')">source</a> ]
134
+ </div>
135
+ <div class="description">
136
+ <p>
137
+ Override this method in a subclass (child) as a callback hook to provide a
138
+ notification plugin.
139
+ </p>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ </div>
145
+
146
+ </body>
147
+ </html>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head><title>inherited (Tweet::Notifier)</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
8
+ <style>
9
+ .ruby-comment { color: green; font-style: italic }
10
+ .ruby-constant { color: #4433aa; font-weight: bold; }
11
+ .ruby-identifier { color: #222222; }
12
+ .ruby-ivar { color: #2233dd; }
13
+ .ruby-keyword { color: #3333FF; font-weight: bold }
14
+ .ruby-node { color: #777777; }
15
+ .ruby-operator { color: #111111; }
16
+ .ruby-regexp { color: #662222; }
17
+ .ruby-value { color: #662222; font-style: italic }
18
+ .kw { color: #3333FF; font-weight: bold }
19
+ .cmt { color: green; font-style: italic }
20
+ .str { color: #662222; font-style: italic }
21
+ .re { color: #662222; }
22
+ </style>
23
+ </head>
24
+ <body bgcolor="white">
25
+ <pre><span class="ruby-comment cmt"># File lib/tweet.rb, line 423</span>
26
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Notifier</span>.<span class="ruby-identifier">inherited</span>(<span class="ruby-identifier">sub</span>)
27
+ <span class="ruby-constant">Notifier</span>.<span class="ruby-identifier">registered_notifiers</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">sub</span>
28
+ <span class="ruby-keyword kw">begin</span>
29
+ <span class="ruby-constant">Syslog</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;registered plugin: #{sub}&quot;</span>)
30
+ <span class="ruby-keyword kw">rescue</span>
31
+ <span class="ruby-keyword kw">end</span>
32
+ <span class="ruby-keyword kw">end</span></pre>
33
+ </body>
34
+ </html>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head><title>show (Tweet::Notifier)</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
8
+ <style>
9
+ .ruby-comment { color: green; font-style: italic }
10
+ .ruby-constant { color: #4433aa; font-weight: bold; }
11
+ .ruby-identifier { color: #222222; }
12
+ .ruby-ivar { color: #2233dd; }
13
+ .ruby-keyword { color: #3333FF; font-weight: bold }
14
+ .ruby-node { color: #777777; }
15
+ .ruby-operator { color: #111111; }
16
+ .ruby-regexp { color: #662222; }
17
+ .ruby-value { color: #662222; font-style: italic }
18
+ .kw { color: #3333FF; font-weight: bold }
19
+ .cmt { color: green; font-style: italic }
20
+ .str { color: #662222; font-style: italic }
21
+ .re { color: #662222; }
22
+ </style>
23
+ </head>
24
+ <body bgcolor="white">
25
+ <pre><span class="ruby-comment cmt"># File lib/tweet.rb, line 433</span>
26
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>(<span class="ruby-identifier">note</span>)
27
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;[tweet!] #{note}&quot;</span>
28
+ <span class="ruby-keyword kw">end</span></pre>
29
+ </body>
30
+ </html>
@@ -0,0 +1,336 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title>Module: Tweet</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
+ <td class="file-title"><span class="file-title-prefix">Module</span><br />Tweet</td>
55
+ <td align="right">
56
+ <table cellspacing=0 cellpadding=2>
57
+ <tr valign="top">
58
+ <td>In:</td>
59
+ <td>
60
+ <a href="../files/lib/tweet_rb.html">lib/tweet.rb</a>
61
+ </td>
62
+ </tr>
63
+ </table>
64
+ </td>
65
+ </tr>
66
+ </table>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+ <div id="content">
71
+
72
+ <div class="description"><h1><a href="Tweet.html">Tweet</a></h1>
73
+ <h2>Synopsis</h2>
74
+ <p>
75
+ A generalized notification daemon. Can be petitioned by an arbitrary
76
+ application to activate a notification. Notifications can be customized by
77
+ the user via a plugin architecture. Examples include a GTK2 popup dialog, a
78
+ syslog entry, or an email alert.
79
+ </p>
80
+ <p>
81
+ Can also be required in a ruby script to access a running <a
82
+ href="Tweet.html">Tweet</a> daemon (see <a
83
+ href="Tweet.html#M000011">Tweet.notify</a>, <a
84
+ href="Tweet.html#M000012">Tweet.message</a>, Tweet.running?, <a
85
+ href="Tweet.html#M000016">Tweet.stop</a>).
86
+ </p>
87
+ <p>
88
+ The website is here: <a
89
+ href="http://tweet.rubyforge.org">tweet.rubyforge.org</a>/
90
+ </p>
91
+ <h2>Installation</h2>
92
+ <pre>
93
+ gem install tweet
94
+ </pre>
95
+ <p>
96
+ or maybe:
97
+ </p>
98
+ <pre>
99
+ sudo gem install tweet
100
+ </pre>
101
+ <h2>Usage</h2>
102
+ <pre>
103
+ tweetd [options]
104
+ </pre>
105
+ <h2>Requirements</h2>
106
+ <ul>
107
+ <li>Ruby 1.8
108
+
109
+ </li>
110
+ <li>daemons library
111
+
112
+ </li>
113
+ <li>pidify library
114
+
115
+ </li>
116
+ </ul>
117
+ <h2>Examples</h2>
118
+ <p>
119
+ To start the daemon:
120
+ </p>
121
+ <pre>
122
+ tweetd -d
123
+ </pre>
124
+ <p>
125
+ To contact the daemon from the shell:
126
+ </p>
127
+ <pre>
128
+ tweet &quot;hello world&quot;
129
+ </pre>
130
+ <p>
131
+ To contact the daemon from ruby:
132
+ </p>
133
+ <pre>
134
+ require 'tweet'
135
+ Tweet.message(&quot;hello world&quot;)
136
+ </pre>
137
+ <h2>Author</h2>
138
+ <p>
139
+ Payton Swick, 2006
140
+ </p>
141
+ <h2>License Creative Commons GPL license.</h2>
142
+ <p>
143
+ <a
144
+ href="http://creativecommons.org/licenses/GPL/2.0">creativecommons.org/licenses/GPL/2.0</a>/
145
+ </p>
146
+ </div>
147
+
148
+
149
+
150
+ <div class="sectiontitle">Methods</div>
151
+ <ul>
152
+ <li><a href="#M000012">message</a></li>
153
+ <li><a href="#M000013">message_with_notifiers</a></li>
154
+ <li><a href="#M000011">notify</a></li>
155
+ <li><a href="#M000015">running?</a></li>
156
+ <li><a href="#M000017">start</a></li>
157
+ <li><a href="#M000016">stop</a></li>
158
+ <li><a href="#M000014">where_am_i?</a></li>
159
+ </ul>
160
+
161
+
162
+
163
+ <div class="sectiontitle">Classes and Modules</div>
164
+ Class <a href="Tweet/Monitor.html" class="link">Tweet::Monitor</a><br />
165
+ Class <a href="Tweet/Note.html" class="link">Tweet::Note</a><br />
166
+ Class <a href="Tweet/Notifier.html" class="link">Tweet::Notifier</a><br />
167
+
168
+
169
+ <div class="sectiontitle">Constants</div>
170
+ <table border='0' cellpadding='5'>
171
+ <tr valign='top'>
172
+ <td class="attr-name">VERSION</td>
173
+ <td>=</td>
174
+ <td class="attr-value">'0.6'</td>
175
+ </tr>
176
+ <tr valign='top'>
177
+ <td class="attr-name">PRI</td>
178
+ <td>=</td>
179
+ <td class="attr-value">{ 'CRITICAL' =&gt; 1, 'WARNING' =&gt; 2, 'INFO' =&gt; 3, 'LOW' =&gt; 4, 'DEBUG' =&gt; 5</td>
180
+ </tr>
181
+ <tr valign='top'>
182
+ <td>&nbsp;</td>
183
+ <td colspan="2" class="attr-desc">
184
+ Priority levels.
185
+
186
+ <p>
187
+ They can be referenced from other classes like this:
188
+ </p>
189
+ <pre>
190
+ Tweet::PRI['WARNING']
191
+ </pre>
192
+ </td>
193
+ </tr>
194
+ <tr valign='top'>
195
+ <td class="attr-name">PORT</td>
196
+ <td>=</td>
197
+ <td class="attr-value">9128</td>
198
+ </tr>
199
+ <tr valign='top'>
200
+ <td>&nbsp;</td>
201
+ <td colspan="2" class="attr-desc">
202
+ The TCP port to listen on.
203
+
204
+ </td>
205
+ </tr>
206
+ <tr valign='top'>
207
+ <td class="attr-name">USE_SYSLOG</td>
208
+ <td>=</td>
209
+ <td class="attr-value">true</td>
210
+ </tr>
211
+ <tr valign='top'>
212
+ <td>&nbsp;</td>
213
+ <td colspan="2" class="attr-desc">
214
+ Enable using syslog for tweetd events (this is different from the syslog
215
+ notifier plugin, as it does not log notifications. This logs only tweetd
216
+ activity, eg: stopping and starting.)
217
+
218
+ </td>
219
+ </tr>
220
+ <tr valign='top'>
221
+ <td class="attr-name">USE_GTK_TRAY_ICON</td>
222
+ <td>=</td>
223
+ <td class="attr-value">true</td>
224
+ </tr>
225
+ <tr valign='top'>
226
+ <td>&nbsp;</td>
227
+ <td colspan="2" class="attr-desc">
228
+ Experimental GTK Tray icon.
229
+
230
+ </td>
231
+ </tr>
232
+ </table>
233
+
234
+
235
+ <div class="sectiontitle">Public Class methods</div>
236
+ <div class="method">
237
+ <div class="title">
238
+ <a name="M000012"></a><b>message</b>(message, duration=0)
239
+ [ <a href="javascript:openCode('Tweet.src/M000012.html')">source</a> ]
240
+ </div>
241
+ <div class="description">
242
+ <p>
243
+ Given a String, this will try to contact a running tweet instance and send
244
+ the String as a notification from the calling application with a duration
245
+ of a number of seconds (the default is a duration of 0 (permanent)). This
246
+ is a simple form of Tweet::notify.
247
+ </p>
248
+ <p>
249
+ Example:
250
+ </p>
251
+ <pre>
252
+ require 'tweet'
253
+ Tweet.message &quot;Hello World!&quot;
254
+ </pre>
255
+ </div>
256
+ </div>
257
+ <div class="method">
258
+ <div class="title">
259
+ <a name="M000013"></a><b>message_with_notifiers</b>(message, notifiers=[], duration=0)
260
+ [ <a href="javascript:openCode('Tweet.src/M000013.html')">source</a> ]
261
+ </div>
262
+ <div class="description">
263
+ <p>
264
+ Just like <a href="Tweet.html#M000012">Tweet.message</a>, but allows
265
+ specifying an array of notifier plugins to use as requested notifiers on
266
+ the server. See <a href="Tweet/Monitor.html">Monitor</a> for more
267
+ information.
268
+ </p>
269
+ </div>
270
+ </div>
271
+ <div class="method">
272
+ <div class="title">
273
+ <a name="M000011"></a><b>notify</b>(note)
274
+ [ <a href="javascript:openCode('Tweet.src/M000011.html')">source</a> ]
275
+ </div>
276
+ <div class="description">
277
+ <p>
278
+ Given an instance of <a href="Tweet/Note.html">Note</a>, this will try to
279
+ contact a running tweet instance and send a notification. See
280
+ Tweet::message for a simpler version.
281
+ </p>
282
+ <p>
283
+ Example:
284
+ </p>
285
+ <pre>
286
+ require 'tweet'
287
+ Tweet.notify(Tweet::Note.info(&quot;Hello World&quot;, &quot;Hello World!&quot;, &quot;5&quot;, &quot;test application&quot;))
288
+ </pre>
289
+ </div>
290
+ </div>
291
+ <div class="method">
292
+ <div class="title">
293
+ <a name="M000015"></a><b>running?</b>()
294
+ [ <a href="javascript:openCode('Tweet.src/M000015.html')">source</a> ]
295
+ </div>
296
+ <div class="description">
297
+ <p>
298
+ Returns true if an instance of tweetd is running (or appears to be
299
+ running).
300
+ </p>
301
+ </div>
302
+ </div>
303
+ <div class="method">
304
+ <div class="title">
305
+ <a name="M000017"></a><b>start</b>()
306
+ [ <a href="javascript:openCode('Tweet.src/M000017.html')">source</a> ]
307
+ </div>
308
+ </div>
309
+ <div class="method">
310
+ <div class="title">
311
+ <a name="M000016"></a><b>stop</b>()
312
+ [ <a href="javascript:openCode('Tweet.src/M000016.html')">source</a> ]
313
+ </div>
314
+ <div class="description">
315
+ <p>
316
+ Stops a running instance of tweetd.
317
+ </p>
318
+ </div>
319
+ </div>
320
+ <div class="method">
321
+ <div class="title">
322
+ <a name="M000014"></a><b>where_am_i?</b>()
323
+ [ <a href="javascript:openCode('Tweet.src/M000014.html')">source</a> ]
324
+ </div>
325
+ <div class="description">
326
+ <p>
327
+ Returns the path location to the library file.
328
+ </p>
329
+ </div>
330
+ </div>
331
+ </div>
332
+
333
+ </div>
334
+
335
+ </body>
336
+ </html>
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head><title>notify (Tweet)</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
8
+ <style>
9
+ .ruby-comment { color: green; font-style: italic }
10
+ .ruby-constant { color: #4433aa; font-weight: bold; }
11
+ .ruby-identifier { color: #222222; }
12
+ .ruby-ivar { color: #2233dd; }
13
+ .ruby-keyword { color: #3333FF; font-weight: bold }
14
+ .ruby-node { color: #777777; }
15
+ .ruby-operator { color: #111111; }
16
+ .ruby-regexp { color: #662222; }
17
+ .ruby-value { color: #662222; font-style: italic }
18
+ .kw { color: #3333FF; font-weight: bold }
19
+ .cmt { color: green; font-style: italic }
20
+ .str { color: #662222; font-style: italic }
21
+ .re { color: #662222; }
22
+ </style>
23
+ </head>
24
+ <body bgcolor="white">
25
+ <pre><span class="ruby-comment cmt"># File lib/tweet.rb, line 97</span>
26
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">notify</span>(<span class="ruby-identifier">note</span>)
27
+ <span class="ruby-identifier">require</span> <span class="ruby-value str">'net/telnet'</span>
28
+ <span class="ruby-identifier">message</span> = <span class="ruby-value str">'app &quot;'</span><span class="ruby-operator">+</span><span class="ruby-identifier">note</span>.<span class="ruby-identifier">application</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">+</span><span class="ruby-value str">'&quot;;priority &quot;'</span><span class="ruby-operator">+</span><span class="ruby-identifier">note</span>.<span class="ruby-identifier">priority</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">+</span><span class="ruby-value str">'&quot;;duration &quot;'</span><span class="ruby-operator">+</span><span class="ruby-identifier">note</span>.<span class="ruby-identifier">duration</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">+</span><span class="ruby-value str">'&quot;;notifier &quot;'</span><span class="ruby-operator">+</span><span class="ruby-identifier">note</span>.<span class="ruby-identifier">requested_notifiers</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)<span class="ruby-operator">+</span><span class="ruby-value str">'&quot;;title &quot;'</span><span class="ruby-operator">+</span><span class="ruby-identifier">note</span>.<span class="ruby-identifier">title</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">+</span><span class="ruby-value str">'&quot;;message &quot;'</span><span class="ruby-operator">+</span><span class="ruby-identifier">note</span>.<span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">+</span><span class="ruby-value str">'&quot;'</span>
29
+ <span class="ruby-keyword kw">begin</span>
30
+ <span class="ruby-identifier">conn</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">Telnet</span>.<span class="ruby-identifier">new</span>({<span class="ruby-value str">'Host'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'localhost'</span>, <span class="ruby-value str">'Port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">PORT</span>, <span class="ruby-value str">'Telnet mode'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span> })
31
+ <span class="ruby-keyword kw">rescue</span>
32
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Connection to tweet failed. Maybe tweetd is not running?&quot;</span>
33
+ <span class="ruby-keyword kw">end</span>
34
+ <span class="ruby-identifier">out</span> = <span class="ruby-identifier">conn</span>.<span class="ruby-identifier">recv</span>(<span class="ruby-value">128</span>)
35
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;While trying to connect to tweetd, server replied: '#{out.chomp}'&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">out</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/^2/</span>
36
+ <span class="ruby-identifier">conn</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">message</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;\n&quot;</span>)
37
+ <span class="ruby-identifier">out</span> = <span class="ruby-identifier">conn</span>.<span class="ruby-identifier">recv</span>(<span class="ruby-value">128</span>)
38
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;While trying to send this: '#{message}', tweetd replied: '#{out.chomp}'&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">out</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/^2/</span>
39
+ <span class="ruby-identifier">conn</span>.<span class="ruby-identifier">close</span>
40
+ <span class="ruby-keyword kw">end</span></pre>
41
+ </body>
42
+ </html>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head><title>message (Tweet)</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
8
+ <style>
9
+ .ruby-comment { color: green; font-style: italic }
10
+ .ruby-constant { color: #4433aa; font-weight: bold; }
11
+ .ruby-identifier { color: #222222; }
12
+ .ruby-ivar { color: #2233dd; }
13
+ .ruby-keyword { color: #3333FF; font-weight: bold }
14
+ .ruby-node { color: #777777; }
15
+ .ruby-operator { color: #111111; }
16
+ .ruby-regexp { color: #662222; }
17
+ .ruby-value { color: #662222; font-style: italic }
18
+ .kw { color: #3333FF; font-weight: bold }
19
+ .cmt { color: green; font-style: italic }
20
+ .str { color: #662222; font-style: italic }
21
+ .re { color: #662222; }
22
+ </style>
23
+ </head>
24
+ <body bgcolor="white">
25
+ <pre><span class="ruby-comment cmt"># File lib/tweet.rb, line 121</span>
26
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">duration</span>=<span class="ruby-value">0</span>)
27
+ <span class="ruby-identifier">notify</span>(<span class="ruby-constant">Note</span>.<span class="ruby-identifier">info</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">duration</span>, <span class="ruby-identifier">$0</span>))
28
+ <span class="ruby-keyword kw">end</span></pre>
29
+ </body>
30
+ </html>