File: Plugin.html

package info (click to toggle)
rbot 0.9.7-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,536 kB
  • ctags: 667
  • sloc: ruby: 5,581; xml: 99; makefile: 15; sh: 1
file content (234 lines) | stat: -rw-r--r-- 9,359 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html><head>
  <title>Class: Irc::Plugin</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel=StyleSheet href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript" language="JavaScript">
  <!--
  function popCode(url) {
    window.open(url, "Code", 
          "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }
  //-->
  </script>
</head>

<body bgcolor="white">

<table summary="Information on class" width="100%" border="0" cellspacing="0">
 <tr class="title-row">
 <td class="big-title-font">
   <sup><font color="aqua">Class</font></sup> Irc::Plugin
 </td>
 <td align="right">
   <table summary="layout" cellspacing="0" cellpadding="2">
     <tr valign="top">
      <td class="small-title-font">In:</td>
      <td class="small-title-font">
        <a href="../../files/rbot/plugins_rb.html" class="aqua">
rbot/plugins.rb
         </a>
<br />
      </td>
     </tr>
     <tr>
      <td class="small-title-font">Parent:</td>
      <td class="small-title-font">
Object
      </td>
     </tr>
   </table>
  </td>
  </tr>
</table>
  <!-- banner header -->

<table summary="Diagram of classes and modules" width="100%">
<tr><td align="center">
<map name="map">
  <area shape="RECT" coords="256,205,336,157"      href="JoinMessage.html" alt="Class: JoinMessage">
  <area shape="RECT" coords="256,301,336,253"      href="PartMessage.html" alt="Class: PartMessage">
  <area shape="RECT" coords="1556,109,1628,61"      href="Plugins.html" alt="Class: Plugins">
  <area shape="RECT" coords="360,205,440,157"      href="KickMessage.html" alt="Class: KickMessage">
  <area shape="RECT" coords="1460,109,1532,61"      href="IrcAuth.html" alt="Class: IrcAuth">
  <area shape="RECT" coords="1359,109,1436,61"      href="IRCChannel.html" alt="Class: IRCChannel">
  <area shape="RECT" coords="28,205,100,157"      href="BotConfig.html" alt="Class: BotConfig">
  <area shape="RECT" coords="1263,109,1335,61"      href="IrcSocket.html" alt="Class: IrcSocket">
  <area shape="RECT" coords="1167,109,1239,61"      href="Keywords.html" alt="Class: Keywords">
  <area shape="RECT" coords="1025,109,1143,61"      href="BotRegistryAccessor.html" alt="Class: BotRegistryAccessor">
  <area shape="RECT" coords="929,109,1001,61"      href="DBHash.html" alt="Class: DBHash">
  <area shape="RECT" coords="833,109,905,61"      href="IrcClient.html" alt="Class: IrcClient">
  <area shape="RECT" coords="737,109,809,61"      href="IrcBot.html" alt="Class: IrcBot">
  <area shape="RECT" coords="641,109,713,61"      href="Language.html" alt="Class: Language">
  <area shape="RECT" coords="464,205,552,157"      href="TopicMessage.html" alt="Class: TopicMessage">
  <area shape="RECT" coords="576,205,656,157"      href="QuitMessage.html" alt="Class: QuitMessage">
  <area shape="RECT" coords="627,301,707,253"      href="PrivMessage.html" alt="Class: PrivMessage">
  <area shape="RECT" coords="680,205,763,157"      href="UserMessage.html" alt="Class: UserMessage">
  <area shape="RECT" coords="731,301,821,253"      href="NoticeMessage.html" alt="Class: NoticeMessage">
  <area shape="RECT" coords="508,109,617,61"      href="BasicUserMessage.html" alt="Class: BasicUserMessage">
  <area shape="RECT" coords="787,205,867,157"      href="NickMessage.html" alt="Class: NickMessage">
  <area shape="RECT" coords="412,109,484,61"      href="Plugin.html" alt="Class: Plugin">
  <area shape="RECT" coords="316,109,388,61"      href="BotRegistry.html" alt="Class: BotRegistry">
  <area shape="RECT" coords="220,109,292,61"      href="Keyword.html" alt="Class: Keyword">
  <area shape="RECT" coords="124,109,196,61"      href="DBTree.html" alt="Class: DBTree">
</map>
<img src="../../dot/m_16_0.png" usemap="#map" border=0 alt="Module: Irc">
</td></tr></table>


<div class="description"><p>
base class for all rbot plugins certain methods will be called if they are
provided, if you define one of the following methods, it will be called as
appropriate:
</p>
<table>
<tr><td valign="top">listen(<a href="UserMessage.html">UserMessage</a>):</td><td>Called for all messages of any type. To differentiate them, use
message.kind_of? It'll be either a <a
href="PrivMessage.html">PrivMessage</a>, <a
href="NoticeMessage.html">NoticeMessage</a>, <a
href="KickMessage.html">KickMessage</a>, <a
href="QuitMessage.html">QuitMessage</a>, <a
href="PartMessage.html">PartMessage</a>, <a
href="JoinMessage.html">JoinMessage</a>, <a
href="NickMessage.html">NickMessage</a>, etc.

</td></tr>
<tr><td valign="top">privmsg(<a href="PrivMessage.html">PrivMessage</a>):</td><td>called for a PRIVMSG if the first word matches one the plugin register()d
for. Use m.plugin to get that word and m.params for the rest of the
message, if applicable.

</td></tr>
<tr><td valign="top">kick(<a href="KickMessage.html">KickMessage</a>):</td><td>Called when a user (or the bot) is kicked from a channel the bot is in.

</td></tr>
<tr><td valign="top">join(<a href="JoinMessage.html">JoinMessage</a>):</td><td>Called when a user (or the bot) joins a channel

</td></tr>
<tr><td valign="top">part(<a href="PartMessage.html">PartMessage</a>):</td><td>Called when a user (or the bot) parts a channel

</td></tr>
<tr><td valign="top">quit(<a href="QuitMessage.html">QuitMessage</a>):</td><td>Called when a user (or the bot) quits IRC

</td></tr>
<tr><td valign="top">nick(<a href="NickMessage.html">NickMessage</a>):</td><td>Called when a user (or the bot) changes Nick

</td></tr>
<tr><td valign="top">topic(<a href="TopicMessage.html">TopicMessage</a>):</td><td>Called when a user (or the bot) changes a channel topic

</td></tr>
<tr><td valign="top">save:</td><td>Called when you are required to save your plugin's state, if you maintain
data between sessions

</td></tr>
<tr><td valign="top">cleanup:</td><td>called before your plugin is &quot;unloaded&quot;, prior to a plugin reload
or bot quit - close any open files/connections or flush caches here

</td></tr>
</table>
</div>


<table summary="Methods" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Methods</td></tr>
</table>
<div class="name-list">
<a href="#M000170">help</a>&nbsp; &nbsp;
<a href="#M000172">listen?</a>&nbsp; &nbsp;
<a href="#M000169">name</a>&nbsp; &nbsp;
<a href="#M000168">new</a>&nbsp; &nbsp;
<a href="#M000171">register</a>&nbsp; &nbsp;
</div>




<table summary="Method list" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Public Class methods</td></tr>
</table>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000168"></a>
<a href="Plugin.src/M000168.html" target="Code" class="methodtitle"
 onClick="popCode('Plugin.src/M000168.html');return false;">
<b>new</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
initialise your plugin. Always call super if you override this method, as
important variables are set up for you
</p>
</div>
<table summary="Method list" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Public Instance methods</td></tr>
</table>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000169"></a>
<a href="Plugin.src/M000169.html" target="Code" class="methodtitle"
 onClick="popCode('Plugin.src/M000169.html');return false;">
<b>name</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
return an identifier for this plugin, defaults to a list of the message
prefixes handled (used for error messages etc)
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000170"></a>
<a href="Plugin.src/M000170.html" target="Code" class="methodtitle"
 onClick="popCode('Plugin.src/M000170.html');return false;">
<b>help</b>(plugin, topic)
</a>
</td></tr>
</table>
<div class="description">
<p>
return a help string for your module. for complex modules, you may wish to
break your help into topics, and return a list of available topics if
<tt>topic</tt> is nil. <tt>plugin</tt> is passed containing the matching
prefix for this message - if your plugin handles multiple prefixes, make
sure your return the correct help for the prefix requested
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000171"></a>
<a href="Plugin.src/M000171.html" target="Code" class="methodtitle"
 onClick="popCode('Plugin.src/M000171.html');return false;">
<b>register</b>(name)
</a>
</td></tr>
</table>
<div class="description">
<p>
register the plugin as a handler for messages prefixed <tt>name</tt> this
can be called multiple times for a plugin to handle multiple message
prefixes
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000172"></a>
<a href="Plugin.src/M000172.html" target="Code" class="methodtitle"
 onClick="popCode('Plugin.src/M000172.html');return false;">
<b>listen?</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
is this plugin listening to all messages?
</p>
</div>

</body>