safubot 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.md +19 -0
  4. data/README.md +43 -0
  5. data/Rakefile +1 -0
  6. data/doc/Gemfile.html +119 -0
  7. data/doc/Object.html +171 -0
  8. data/doc/Rakefile.html +117 -0
  9. data/doc/Safubot.html +173 -0
  10. data/doc/Safubot/Bot.html +827 -0
  11. data/doc/Safubot/Evented.html +346 -0
  12. data/doc/Safubot/KnownUser.html +344 -0
  13. data/doc/Safubot/Log.html +254 -0
  14. data/doc/Safubot/Query.html +217 -0
  15. data/doc/Safubot/Request.html +201 -0
  16. data/doc/Safubot/Response.html +174 -0
  17. data/doc/Safubot/Test.html +244 -0
  18. data/doc/Safubot/Twitter.html +153 -0
  19. data/doc/Safubot/Twitter/Bot.html +591 -0
  20. data/doc/Safubot/Twitter/DirectMessage.html +327 -0
  21. data/doc/Safubot/Twitter/Tweet.html +522 -0
  22. data/doc/Safubot/XMPP.html +153 -0
  23. data/doc/Safubot/XMPP/Bot.html +403 -0
  24. data/doc/Safubot/XMPP/Message.html +298 -0
  25. data/doc/created.rid +14 -0
  26. data/doc/foo_rb.html +115 -0
  27. data/doc/images/add.png +0 -0
  28. data/doc/images/brick.png +0 -0
  29. data/doc/images/brick_link.png +0 -0
  30. data/doc/images/bug.png +0 -0
  31. data/doc/images/bullet_black.png +0 -0
  32. data/doc/images/bullet_toggle_minus.png +0 -0
  33. data/doc/images/bullet_toggle_plus.png +0 -0
  34. data/doc/images/date.png +0 -0
  35. data/doc/images/delete.png +0 -0
  36. data/doc/images/find.png +0 -0
  37. data/doc/images/loadingAnimation.gif +0 -0
  38. data/doc/images/macFFBgHack.png +0 -0
  39. data/doc/images/package.png +0 -0
  40. data/doc/images/page_green.png +0 -0
  41. data/doc/images/page_white_text.png +0 -0
  42. data/doc/images/page_white_width.png +0 -0
  43. data/doc/images/plugin.png +0 -0
  44. data/doc/images/ruby.png +0 -0
  45. data/doc/images/tag_blue.png +0 -0
  46. data/doc/images/tag_green.png +0 -0
  47. data/doc/images/transparent.png +0 -0
  48. data/doc/images/wrench.png +0 -0
  49. data/doc/images/wrench_orange.png +0 -0
  50. data/doc/images/zoom.png +0 -0
  51. data/doc/index.html +112 -0
  52. data/doc/js/darkfish.js +153 -0
  53. data/doc/js/jquery.js +18 -0
  54. data/doc/js/navigation.js +142 -0
  55. data/doc/js/search.js +94 -0
  56. data/doc/js/search_index.js +1 -0
  57. data/doc/js/searcher.js +228 -0
  58. data/doc/lib/safubot/bot_rb.html +115 -0
  59. data/doc/lib/safubot/evented_rb.html +115 -0
  60. data/doc/lib/safubot/known_user_rb.html +115 -0
  61. data/doc/lib/safubot/log_rb.html +115 -0
  62. data/doc/lib/safubot/safubot_rb.html +115 -0
  63. data/doc/lib/safubot/spec/bot_spec_rb.html +115 -0
  64. data/doc/lib/safubot/spec/twitter_spec_rb.html +137 -0
  65. data/doc/lib/safubot/test_helper_rb.html +115 -0
  66. data/doc/lib/safubot/twitter_rb.html +115 -0
  67. data/doc/lib/safubot/version_rb.html +115 -0
  68. data/doc/lib/safubot/xmpp_rb.html +115 -0
  69. data/doc/lib/safubot_rb.html +115 -0
  70. data/doc/rdoc.css +543 -0
  71. data/doc/table_of_contents.html +224 -0
  72. data/lib/safubot.rb +20 -0
  73. data/lib/safubot/bot.rb +177 -0
  74. data/lib/safubot/evented.rb +52 -0
  75. data/lib/safubot/known_user.rb +27 -0
  76. data/lib/safubot/log.rb +21 -0
  77. data/lib/safubot/test_helper.rb +62 -0
  78. data/lib/safubot/twitter.rb +279 -0
  79. data/lib/safubot/version.rb +3 -0
  80. data/lib/safubot/xmpp.rb +144 -0
  81. data/safubot.gemspec +32 -0
  82. data/spec/fixtures/twitter/direct_message +1 -0
  83. data/spec/fixtures/twitter/tweet +1 -0
  84. data/spec/fixtures/xmpp/message +3 -0
  85. data/spec/helper.rb +12 -0
  86. data/spec/safubot/bot_spec.rb +41 -0
  87. data/spec/safubot/evented_spec.rb +45 -0
  88. data/spec/safubot/known_user_spec.rb +22 -0
  89. data/spec/safubot/twitter_spec.rb +60 -0
  90. data/spec/safubot/xmpp_spec.rb +35 -0
  91. metadata +260 -0
@@ -0,0 +1,153 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Module: Safubot::XMPP</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/safubot/xmpp.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+
60
+
61
+
62
+ </div>
63
+
64
+ <div id="project-metadata">
65
+ <nav id="fileindex-section" class="section project-section">
66
+ <h3 class="section-header">Pages</h3>
67
+
68
+ <ul>
69
+
70
+ <li class="file"><a href="../Gemfile.html">Gemfile</a>
71
+
72
+ <li class="file"><a href="../Rakefile.html">Rakefile</a>
73
+
74
+ </ul>
75
+ </nav>
76
+
77
+ <nav id="classindex-section" class="section project-section">
78
+ <h3 class="section-header">Class and Module Index</h3>
79
+
80
+ <ul class="link-list">
81
+
82
+ <li><a href="../Safubot.html">Safubot</a>
83
+
84
+ <li><a href="../Safubot/Bot.html">Safubot::Bot</a>
85
+
86
+ <li><a href="../Safubot/Evented.html">Safubot::Evented</a>
87
+
88
+ <li><a href="../Safubot/KnownUser.html">Safubot::KnownUser</a>
89
+
90
+ <li><a href="../Safubot/Log.html">Safubot::Log</a>
91
+
92
+ <li><a href="../Safubot/Query.html">Safubot::Query</a>
93
+
94
+ <li><a href="../Safubot/Request.html">Safubot::Request</a>
95
+
96
+ <li><a href="../Safubot/Response.html">Safubot::Response</a>
97
+
98
+ <li><a href="../Safubot/Test.html">Safubot::Test</a>
99
+
100
+ <li><a href="../Safubot/Twitter.html">Safubot::Twitter</a>
101
+
102
+ <li><a href="../Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
103
+
104
+ <li><a href="../Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
105
+
106
+ <li><a href="../Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
107
+
108
+ <li><a href="../Safubot/XMPP.html">Safubot::XMPP</a>
109
+
110
+ <li><a href="../Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
111
+
112
+ <li><a href="../Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
113
+
114
+ <li><a href="../Object.html">Object</a>
115
+
116
+ </ul>
117
+ </nav>
118
+
119
+ </div>
120
+ </nav>
121
+
122
+ <div id="documentation">
123
+ <h1 class="module">module Safubot::XMPP</h1>
124
+
125
+ <div id="description" class="description">
126
+
127
+ </div><!-- description -->
128
+
129
+
130
+
131
+
132
+ <section id="5Buntitled-5D" class="documentation-section">
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ <!-- Methods -->
142
+
143
+ </section><!-- 5Buntitled-5D -->
144
+
145
+ </div><!-- documentation -->
146
+
147
+
148
+ <footer id="validator-badges">
149
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
150
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
151
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
152
+ </footer>
153
+
@@ -0,0 +1,403 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Class: Safubot::XMPP::Bot</title>
8
+
9
+ <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../../index.html">Home</a>
28
+ <a href="../../table_of_contents.html#classes">Classes</a>
29
+ <a href="../../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/safubot/xmpp.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link"><a href="../../Object.html">Object</a>
63
+
64
+ </nav>
65
+
66
+ <!-- Included Modules -->
67
+ <nav id="includes-section" class="section">
68
+ <h3 class="section-header">Included Modules</h3>
69
+
70
+ <ul class="link-list">
71
+
72
+
73
+ <li><a class="include" href="../Evented.html">Safubot::Evented</a>
74
+
75
+
76
+ </ul>
77
+ </nav>
78
+
79
+ <!-- Method Quickref -->
80
+ <nav id="method-list-section" class="section">
81
+ <h3 class="section-header">Methods</h3>
82
+
83
+ <ul class="link-list">
84
+
85
+ <li><a href="#method-c-new">::new</a>
86
+
87
+ <li><a href="#method-i-run">#run</a>
88
+
89
+ <li><a href="#method-i-send">#send</a>
90
+
91
+ <li><a href="#method-i-stop">#stop</a>
92
+
93
+ </ul>
94
+ </nav>
95
+
96
+ </div>
97
+
98
+ <div id="project-metadata">
99
+ <nav id="fileindex-section" class="section project-section">
100
+ <h3 class="section-header">Pages</h3>
101
+
102
+ <ul>
103
+
104
+ <li class="file"><a href="../../Gemfile.html">Gemfile</a>
105
+
106
+ <li class="file"><a href="../../Rakefile.html">Rakefile</a>
107
+
108
+ </ul>
109
+ </nav>
110
+
111
+ <nav id="classindex-section" class="section project-section">
112
+ <h3 class="section-header">Class and Module Index</h3>
113
+
114
+ <ul class="link-list">
115
+
116
+ <li><a href="../../Safubot.html">Safubot</a>
117
+
118
+ <li><a href="../../Safubot/Bot.html">Safubot::Bot</a>
119
+
120
+ <li><a href="../../Safubot/Evented.html">Safubot::Evented</a>
121
+
122
+ <li><a href="../../Safubot/KnownUser.html">Safubot::KnownUser</a>
123
+
124
+ <li><a href="../../Safubot/Log.html">Safubot::Log</a>
125
+
126
+ <li><a href="../../Safubot/Query.html">Safubot::Query</a>
127
+
128
+ <li><a href="../../Safubot/Request.html">Safubot::Request</a>
129
+
130
+ <li><a href="../../Safubot/Response.html">Safubot::Response</a>
131
+
132
+ <li><a href="../../Safubot/Test.html">Safubot::Test</a>
133
+
134
+ <li><a href="../../Safubot/Twitter.html">Safubot::Twitter</a>
135
+
136
+ <li><a href="../../Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
137
+
138
+ <li><a href="../../Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
139
+
140
+ <li><a href="../../Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
141
+
142
+ <li><a href="../../Safubot/XMPP.html">Safubot::XMPP</a>
143
+
144
+ <li><a href="../../Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
145
+
146
+ <li><a href="../../Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
147
+
148
+ <li><a href="../../Object.html">Object</a>
149
+
150
+ </ul>
151
+ </nav>
152
+
153
+ </div>
154
+ </nav>
155
+
156
+ <div id="documentation">
157
+ <h1 class="class">class Safubot::XMPP::Bot</h1>
158
+
159
+ <div id="description" class="description">
160
+
161
+ </div><!-- description -->
162
+
163
+
164
+
165
+
166
+ <section id="5Buntitled-5D" class="documentation-section">
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <!-- Attributes -->
175
+ <section id="attribute-method-details" class="method-section section">
176
+ <h3 class="section-header">Attributes</h3>
177
+
178
+
179
+ <div id="attribute-i-client" class="method-detail">
180
+ <div class="method-heading attribute-method-heading">
181
+ <span class="method-name">client</span><span
182
+ class="attribute-access-type">[R]</span>
183
+ </div>
184
+
185
+ <div class="method-description">
186
+
187
+
188
+
189
+ </div>
190
+ </div>
191
+
192
+ <div id="attribute-i-jid" class="method-detail">
193
+ <div class="method-heading attribute-method-heading">
194
+ <span class="method-name">jid</span><span
195
+ class="attribute-access-type">[R]</span>
196
+ </div>
197
+
198
+ <div class="method-description">
199
+
200
+
201
+
202
+ </div>
203
+ </div>
204
+
205
+ <div id="attribute-i-state" class="method-detail">
206
+ <div class="method-heading attribute-method-heading">
207
+ <span class="method-name">state</span><span
208
+ class="attribute-access-type">[R]</span>
209
+ </div>
210
+
211
+ <div class="method-description">
212
+
213
+
214
+
215
+ </div>
216
+ </div>
217
+
218
+ </section><!-- attribute-method-details -->
219
+
220
+
221
+ <!-- Methods -->
222
+
223
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
224
+ <h3 class="section-header">Public Class Methods</h3>
225
+
226
+
227
+ <div id="method-c-new" class="method-detail ">
228
+
229
+ <div class="method-heading">
230
+ <span class="method-name">new</span><span
231
+ class="method-args">(opts)</span>
232
+ <span class="method-click-advice">click to toggle source</span>
233
+ </div>
234
+
235
+
236
+ <div class="method-description">
237
+
238
+
239
+
240
+
241
+
242
+ <div class="method-source-code" id="new-source">
243
+ <pre><span class="ruby-comment"># File lib/safubot/xmpp.rb, line 118</span>
244
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">opts</span>)
245
+ <span class="ruby-ivar">@jid</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:jid</span>]
246
+ <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:password</span>]
247
+ <span class="ruby-ivar">@state</span> = <span class="ruby-value">:stopped</span>
248
+ <span class="ruby-keyword">end</span></pre>
249
+ </div><!-- new-source -->
250
+
251
+ </div>
252
+
253
+
254
+
255
+
256
+ </div><!-- new-method -->
257
+
258
+
259
+ </section><!-- public-class-method-details -->
260
+
261
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
262
+ <h3 class="section-header">Public Instance Methods</h3>
263
+
264
+
265
+ <div id="method-i-run" class="method-detail ">
266
+
267
+ <div class="method-heading">
268
+ <span class="method-name">run</span><span
269
+ class="method-args">()</span>
270
+ <span class="method-click-advice">click to toggle source</span>
271
+ </div>
272
+
273
+
274
+ <div class="method-description">
275
+
276
+ <p>Sets our Blather::Client event processor running.</p>
277
+
278
+
279
+
280
+ <div class="method-source-code" id="run-source">
281
+ <pre><span class="ruby-comment"># File lib/safubot/xmpp.rb, line 69</span>
282
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>
283
+ <span class="ruby-ivar">@client</span> = <span class="ruby-constant">Blather</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">setup</span>(<span class="ruby-ivar">@jid</span>, <span class="ruby-ivar">@password</span>)
284
+
285
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">register_handler</span>(<span class="ruby-value">:ready</span>) <span class="ruby-keyword">do</span>
286
+ <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span> <span class="ruby-node">&quot;XMPP client is online at #{@client.jid.stripped} :D&quot;</span>
287
+ <span class="ruby-identifier">emit</span>(<span class="ruby-value">:ready</span>)
288
+ <span class="ruby-keyword">end</span>
289
+
290
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">register_handler</span>(<span class="ruby-value">:subscription</span>, <span class="ruby-value">:request?</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
291
+ <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span> <span class="ruby-node">&quot;Approving subscription request from: #{s.from}&quot;</span>
292
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">approve!</span>
293
+ <span class="ruby-keyword">end</span>
294
+
295
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">register_handler</span>(<span class="ruby-value">:message</span>, <span class="ruby-value">:chat?</span>, <span class="ruby-value">:body</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">msg</span><span class="ruby-operator">|</span>
296
+ <span class="ruby-keyword">unless</span> <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^\?OTR:/</span>)
297
+ <span class="ruby-identifier">emit</span>(<span class="ruby-value">:request</span>, <span class="ruby-constant">Message</span>.<span class="ruby-identifier">from</span>(<span class="ruby-identifier">msg</span>).<span class="ruby-identifier">make_request</span>)
298
+ <span class="ruby-keyword">end</span>
299
+ <span class="ruby-keyword">end</span>
300
+
301
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">register_handler</span>(<span class="ruby-value">:disconnected</span>) <span class="ruby-keyword">do</span>
302
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@state</span> <span class="ruby-operator">==</span> <span class="ruby-value">:running</span>
303
+ <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span>(<span class="ruby-string">&quot;XMPP disconnected; attempting reconnection.&quot;</span>)
304
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">connect</span>
305
+ <span class="ruby-keyword">end</span>
306
+ <span class="ruby-keyword">end</span>
307
+
308
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">register_handler</span>(<span class="ruby-value">:error</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
309
+ <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span> <span class="ruby-node">&quot;XMPP Error: #{e}&quot;</span>
310
+ <span class="ruby-keyword">end</span>
311
+
312
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">run</span>
313
+
314
+ <span class="ruby-ivar">@state</span> = <span class="ruby-value">:running</span>
315
+ <span class="ruby-keyword">end</span></pre>
316
+ </div><!-- run-source -->
317
+
318
+ </div>
319
+
320
+
321
+
322
+
323
+ </div><!-- run-method -->
324
+
325
+
326
+ <div id="method-i-send" class="method-detail ">
327
+
328
+ <div class="method-heading">
329
+ <span class="method-name">send</span><span
330
+ class="method-args">(resp)</span>
331
+ <span class="method-click-advice">click to toggle source</span>
332
+ </div>
333
+
334
+
335
+ <div class="method-description">
336
+
337
+ <p>Dispatch a <a href="../Response.html">Response</a> via <a
338
+ href="../XMPP.html">XMPP</a>.</p>
339
+
340
+
341
+
342
+ <div class="method-source-code" id="send-source">
343
+ <pre><span class="ruby-comment"># File lib/safubot/xmpp.rb, line 111</span>
344
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">resp</span>)
345
+ <span class="ruby-identifier">msg</span> = <span class="ruby-constant">Blather</span><span class="ruby-operator">::</span><span class="ruby-constant">Stanza</span><span class="ruby-operator">::</span><span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>
346
+ <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">to</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">source</span>.<span class="ruby-identifier">from</span>
347
+ <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">text</span>
348
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">msg</span>
349
+ <span class="ruby-keyword">end</span></pre>
350
+ </div><!-- send-source -->
351
+
352
+ </div>
353
+
354
+
355
+
356
+
357
+ </div><!-- send-method -->
358
+
359
+
360
+ <div id="method-i-stop" class="method-detail ">
361
+
362
+ <div class="method-heading">
363
+ <span class="method-name">stop</span><span
364
+ class="method-args">()</span>
365
+ <span class="method-click-advice">click to toggle source</span>
366
+ </div>
367
+
368
+
369
+ <div class="method-description">
370
+
371
+ <p>Shuts down the Blather client.</p>
372
+
373
+
374
+
375
+ <div class="method-source-code" id="stop-source">
376
+ <pre><span class="ruby-comment"># File lib/safubot/xmpp.rb, line 105</span>
377
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span>
378
+ <span class="ruby-ivar">@state</span> = <span class="ruby-value">:stopped</span>
379
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">close</span>
380
+ <span class="ruby-keyword">end</span></pre>
381
+ </div><!-- stop-source -->
382
+
383
+ </div>
384
+
385
+
386
+
387
+
388
+ </div><!-- stop-method -->
389
+
390
+
391
+ </section><!-- public-instance-method-details -->
392
+
393
+ </section><!-- 5Buntitled-5D -->
394
+
395
+ </div><!-- documentation -->
396
+
397
+
398
+ <footer id="validator-badges">
399
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
400
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
401
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
402
+ </footer>
403
+