mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 04:05:49 +00:00
48305e06e1
Install new css files and alternate images. * README Removed some rot. * events.js Add ability to disable a hook without uninstalling it. Changed return value of addHook to the new hook object. Added getHook(name) method. Removed unused variable from routeEvent. * http.js, irc-debug.js Fixed spelling error. * irc.js network.onConnect no longer forwards the event to the server. Added getModeStr() method to the IRCChanMode object to retrieve the entire mode string for a channel. * utils.js Added Clone() constructor. Fixed problem in stringTrim. Added getStackTrace() ... Whoopee!! ... * bsconnection.c, bsutil.c Stop warnings on Mac. * index.html Change links to buttons to avoid troubles with other methods (href="javascript:f()" | (href="javascript:(void 0)" | href="#") onclick="f()") * test3-commands.js Wiring for /testdisplay and /msg commands. * test3-handlers.js Added debug message toggle menuitem handler. Added style change menu item handler. Added hack to work around bad KeyUp events. Factored out some logic from onInputCompleteLine into getObjectDetails (in test3-static.js) Added /testdisplay and /msg implementation. Fixed error message for unknown network passed to /network. Added topicDate to output of /topic command. updateNetwork and updateChannel calls sprinkled throughout to keep the statusbar current. Added topic change handler. * test3-static.js Post new messages top to bottom!! Disable the debug hook by default. Added getObjectDetails (factored out of test3-handlers.js) Added setOutputStyle to dynamically change the .cs file used for the output window. Implemented updateNetwork and updateChannel. Massive changes to .display methods make output window now display using a table, instead of spans (much faster, btw.) Fixed addHistory to trim the correct side of the output, regardless of print direction. * test3.css Factored out output window styles. * test3.xul Added menu options for debug message toggle and style changes. Added statusbar (table.) * test3-output-default.css, test3-output-marble.css Added output window stylesheets.
175 lines
5.4 KiB
Plaintext
175 lines
5.4 KiB
Plaintext
JavaScript IRC library, bot (runs in xpcshell), and client (runs in Mozilla.)
|
|
|
|
Files You'll find...
|
|
**-------------------------------------------
|
|
irc/bslib
|
|
|
|
basic-socket library. NSPR socket functions wrapped in an object oriented
|
|
C api. Allows clients to connect to as many servers as desired, without
|
|
having to worry about the messy details.
|
|
|
|
**-------------------------------------------
|
|
irc/js/lib
|
|
|
|
JavaScript library files, including...
|
|
|
|
utils.js
|
|
|
|
Utility functions used throughout the other files. Some are very useful,
|
|
some are only slightly useful.
|
|
|
|
events.js
|
|
|
|
Event and EventPump classes. Defines a common way to create and route
|
|
events in JavaScript. Used HEAVILY throughout the rest of the libs to
|
|
perform asychronous tasks. Check the code for more details.
|
|
|
|
connection.js
|
|
|
|
JavaScript wrapper around the bsIConnection component, (CBSConnection).
|
|
This is intended to make it easier to port the library to other (read
|
|
non-XPCOM) JavaScript platforms, or to dump bsIConnection all-together
|
|
when the time is right.
|
|
|
|
http.js
|
|
|
|
Retrieves documents using the HTTP protocol and a CBSConnection. I've got
|
|
the protocol all wrong here, but it will still retrieve the root document
|
|
for a web site. Needs more work.
|
|
|
|
irc.js
|
|
|
|
IRC Library. Provides DOM like access to IRC. This is what your looking
|
|
for.
|
|
|
|
dcc.js
|
|
|
|
DCC Library. DCC is a protocol initiated over irc, and then carried out
|
|
over a Direct Client to Client (hence the name) connection. Currently,
|
|
only DCC-Chat is supported. Adding the rest should be straightforward.
|
|
|
|
**-------------------------------------------
|
|
irc/js/tests
|
|
|
|
Scripts to test the various libraries including...
|
|
|
|
test_matchobject.js
|
|
|
|
Tests the object pattern matching functionality of utils.js. Also a good
|
|
reference while learning the rules for matching an object against a group of
|
|
pattern objects. Object pattern matching is at the root of the hook
|
|
functionality provided by events.js, so look here if you need a clue.
|
|
|
|
ircbot.js
|
|
|
|
The sample bot I use to test the IRC library. It's mostly functional,
|
|
with a few mods you could even use it to secure a channel (if that's what
|
|
you're into.) This is a good place to look to get a feel for how the
|
|
whole thing fits together.
|
|
|
|
**-------------------------------------------
|
|
Misc. Notes...
|
|
|
|
Events By object:
|
|
|
|
The IRCServer object generates/ handles the following events. It is generally
|
|
not advisable to override an event handler defined on the server, unless you
|
|
realize what your replacing. Alternatley, You can hook any of these events
|
|
through the normal event hooking facilities.
|
|
|
|
onRawData:
|
|
name value
|
|
set "server"
|
|
type "parsedata"
|
|
destMethod "onParsedData"
|
|
destObject server (this)
|
|
server server (this)
|
|
connection CBSConnection (this.connection)
|
|
source the <prefix> of the message (if it exists)
|
|
user user object initialized with data from the message <prefix>
|
|
params array containing the <middle> parameters of the message
|
|
code the first <middle> parameter (most messages have this)
|
|
meat the <trailing> parameter of the message
|
|
|
|
onParsedData:
|
|
type <code>.toLowerCase();
|
|
destMethod "on" + <Code>
|
|
|
|
onTopic:
|
|
channel new channel (params[1])
|
|
|
|
on332: topic reply
|
|
channel
|
|
topic
|
|
destObject e.channel
|
|
set "channel"
|
|
|
|
on333: topic info
|
|
channel
|
|
topicBy
|
|
topicDate
|
|
destObject e.channel
|
|
set "channel"
|
|
|
|
on353: name reply (also occurs on join) If this.usersStable == true; clear
|
|
this.users, set usersStable = false. Add all users in this message to
|
|
server.channel.users (which also adds to server.users), setting isOp
|
|
and isVoice, but not host information (because it isnt here.)
|
|
set "channel"
|
|
destObject e.channel
|
|
channel
|
|
|
|
on366: End of names. set usersStable = true; so the next we see a name
|
|
reply, we know it starts
|
|
a new list
|
|
set "channel"
|
|
destObject e.channel
|
|
channel
|
|
|
|
on329: /most likely/ the channel time stamp. sent after a 366
|
|
on some (all?) servers, not in the rev of the RFC I saw.
|
|
set "channel"
|
|
destObject e.channel
|
|
channel
|
|
timeStamp Date
|
|
|
|
on324: channel mode reply, happens in response to a /MODE <channel>.
|
|
type "chanmode"
|
|
destMethod "onChanMode"
|
|
channel
|
|
|
|
onMode: Some user issued a /MODE command relative to some channel the lib
|
|
is active on, *OR* the client's user has changed modes. This message
|
|
is just an incremental update if it relates to the channel.
|
|
channel IF this is in response to a USER mode change, ie, the user
|
|
representing the bot get's set +i or such, this property
|
|
will NOT be defined.
|
|
type "chanmode" or "usermode"
|
|
destMethod "onChanMode" or "onUserMode"
|
|
|
|
|
|
onUserMode: User 'me' has changed mode. Currently ignored.
|
|
|
|
onChanMode: User issued a MODE command in an active channel, or the client's
|
|
user requested a mode update/ joined a new channel.
|
|
When this event completes, the mode property of the channel in
|
|
question will be updated with the information in the event.
|
|
|
|
A channel.onBan event will be created for each ban that appears
|
|
in the new mode.
|
|
set "channel"
|
|
destObject channel
|
|
|
|
onNick: User in one of the active channels has changed their nickname. <user>
|
|
will be renamed on the <server> and all <channel>s in which
|
|
they appear.
|
|
channel
|
|
user
|
|
|
|
onQuit: User in one of the active channels has quit IRC. <user> will be
|
|
deleted from every <channel> they appear in. <server>.<user>
|
|
lastQuitDate and lastQuitMessage will be set.
|
|
channel
|
|
user previous CIRCUser will be upgraded to a CIRCChanUser
|
|
|