Ignore:
Timestamp:
Feb 22, 2009, 9:15:53 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
7743955
Parents:
e625b5e
Message:
IRC: Document most commands and add a quickstart entry.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/IRC/lib/BarnOwl/Module/IRC.pm

    re625b5e rf17bb2c0  
    6969}
    7070
     71sub quickstart {
     72    return <<'END_QUICKSTART';
     73@b[IRC:]
     74Use ':irc-connect @b[server]' to connect to an IRC server, and
     75':irc-join @b[#channel]' to join a channel. ':irc-msg @b[#channel]
     76@b[message]' sends a message to a channel.
     77END_QUICKSTART
     78}
     79
    7180#sub mainloop_hook {
    7281#    return unless defined $irc;
     
    97106
    98107sub register_commands {
    99     BarnOwl::new_command('irc-connect' => \&cmd_connect,
    100                        {
    101                            summary      => 'Connect to an IRC server',
    102                            usage        => 'irc-connect [-a ALIAS ] [-s] [-p PASSWORD] [-n NICK] SERVER [port]',
    103                            description  =>
    104 
    105                            "Connect to an IRC server. Supported options are\n\n" .
    106                            "-a <alias>          Define an alias for this server\n" .
    107                            "-s                  Use SSL\n" .
    108                            "-p <password>       Specify the password to use\n" .
    109                            "-n <nick>           Use a non-default nick"
    110                        });
    111     BarnOwl::new_command('irc-disconnect' => mk_irc_command(\&cmd_disconnect));
    112     BarnOwl::new_command('irc-msg'        => mk_irc_command(\&cmd_msg, OPTIONAL_CHANNEL));
    113     BarnOwl::new_command('irc-mode'       => mk_irc_command(\&cmd_mode, OPTIONAL_CHANNEL));
    114     BarnOwl::new_command('irc-join'       => mk_irc_command(\&cmd_join));
    115     BarnOwl::new_command('irc-part'       => mk_irc_command(\&cmd_part, REQUIRE_CHANNEL));
    116     BarnOwl::new_command('irc-nick'       => mk_irc_command(\&cmd_nick));
    117     BarnOwl::new_command('irc-names'      => mk_irc_command(\&cmd_names, REQUIRE_CHANNEL));
    118     BarnOwl::new_command('irc-whois'      => mk_irc_command(\&cmd_whois));
    119     BarnOwl::new_command('irc-motd'       => mk_irc_command(\&cmd_motd));
    120     BarnOwl::new_command('irc-list'       => \&cmd_list);
    121     BarnOwl::new_command('irc-who'        => mk_irc_command(\&cmd_who));
    122     BarnOwl::new_command('irc-stats'      => mk_irc_command(\&cmd_stats));
    123     BarnOwl::new_command('irc-topic'      => mk_irc_command(\&cmd_topic, REQUIRE_CHANNEL));
    124     BarnOwl::new_command('irc-quote'      => mk_irc_command(\&cmd_quote));
    125 }
     108    BarnOwl::new_command(
     109        'irc-connect' => \&cmd_connect,
     110        {
     111            summary => 'Connect to an IRC server',
     112            usage =>
     113'irc-connect [-a ALIAS ] [-s] [-p PASSWORD] [-n NICK] SERVER [port]',
     114            description =>
     115
     116              <<END_DESCR
     117Connect to an IRC server. Supported options are
     118
     119 -a <alias>          Define an alias for this server
     120 -s                  Use SSL
     121 -p <password>       Specify the password to use
     122 -n <nick>           Use a non-default nick
     123
     124The -a option specifies an alias to use for this connection. This
     125alias can be passed to the '-a' argument of any other IRC command to
     126control which connection it operates on.
     127
     128For servers with hostnames of the form "irc.FOO.{com,org,...}", the
     129alias will default to "FOO"; For other servers the full hostname is
     130used.
     131END_DESCR
     132        }
     133    );
     134
     135    BarnOwl::new_command(
     136        'irc-disconnect' => mk_irc_command( \&cmd_disconnect ),
     137        {
     138            summary => 'Disconnect from an IRC server',
     139            usage   => 'irc-disconnect [-a ALIAS]',
     140
     141            description => <<END_DESCR
     142Disconnect from an IRC server. You can specify a specific server with
     143"-a SERVER-ALIAS" if necessary.
     144END_DESCR
     145        }
     146    );
     147
     148    BarnOwl::new_command(
     149        'irc-msg' => mk_irc_command( \&cmd_msg, OPTIONAL_CHANNEL ),
     150        {
     151            summary => 'Send an IRC message',
     152            usage   => 'irc-msg [-a ALIAS] DESTINATION MESSAGE',
     153
     154            description => <<END_DESCR
     155Send an IRC message
     156END_DESCR
     157        }
     158    );
     159
     160    BarnOwl::new_command(
     161        'irc-mode' => mk_irc_command( \&cmd_mode, OPTIONAL_CHANNEL ),
     162        {
     163            summary => 'Change an IRC channel or user mode',
     164            usage   => 'irc-mode [-a ALIAS] TARGET [+-]MODE OPTIONS',
     165
     166            description => <<END_DESCR
     167
     168Change the mode of an IRC user or channel.
     169END_DESCR
     170        }
     171    );
     172
     173    BarnOwl::new_command(
     174        'irc-join' => mk_irc_command( \&cmd_join ),
     175        {
     176            summary => 'Join an IRC channel',
     177            usage   => 'irc-join [-a ALIAS] #channel',
     178
     179            description => <<END_DESCR
     180
     181Join an IRC channel.
     182END_DESCR
     183        }
     184    );
     185
     186    BarnOwl::new_command(
     187        'irc-part' => mk_irc_command( \&cmd_part, REQUIRE_CHANNEL ),
     188        {
     189            summary => 'Leave an IRC channel',
     190            usage   => 'irc-part [-a ALIAS] #channel',
     191
     192            description => <<END_DESCR
     193
     194Part from an IRC channel.
     195END_DESCR
     196        }
     197    );
     198
     199    BarnOwl::new_command(
     200        'irc-nick' => mk_irc_command( \&cmd_nick ),
     201        {
     202            summary => 'Change your IRC nick on an existing connection.',
     203            usage   => 'irc-nick [-a ALIAS] NEW-NICK',
     204
     205            description => <<END_DESCR
     206
     207Set your IRC nickname on an existing connect. To change it prior to
     208connecting, adjust the `irc:nick' variable.
     209END_DESCR
     210        }
     211    );
     212
     213    BarnOwl::new_command(
     214        'irc-names' => mk_irc_command( \&cmd_names, REQUIRE_CHANNEL ),
     215        {
     216            summary => 'View the list of users in a channel',
     217            usage   => 'irc-names [-a ALIAS] #channel',
     218
     219            description => <<END_DESCR
     220
     221`irc-names' displays the list of users in a given channel in a pop-up
     222window.
     223END_DESCR
     224        }
     225    );
     226
     227    BarnOwl::new_command(
     228        'irc-whois' => mk_irc_command( \&cmd_whois ),
     229        {
     230            summary => 'Displays information about a given IRC user',
     231            usage   => 'irc-whois [-a ALIAS] NICK',
     232
     233            description => <<END_DESCR
     234
     235Pops up information about a given IRC user.
     236END_DESCR
     237        }
     238    );
     239
     240    BarnOwl::new_command(
     241        'irc-motd' => mk_irc_command( \&cmd_motd ),
     242        {
     243            summary => 'Displays an IRC server\'s MOTD (Message of the Day)',
     244            usage   => 'irc-motd [-a ALIAS]',
     245
     246            description => <<END_DESCR
     247
     248Displays an IRC server's message of the day.
     249END_DESCR
     250        }
     251    );
     252
     253    BarnOwl::new_command(
     254        'irc-list' => \&cmd_list,
     255        {
     256            summary => 'Show all the active IRC connections.',
     257            usage   => 'irc-list',
     258
     259            description => <<END_DESCR
     260
     261Show all the currently active IRC connections with their aliases and
     262server names.
     263END_DESCR
     264        }
     265    );
     266
     267    BarnOwl::new_command( 'irc-who'   => mk_irc_command( \&cmd_who ) );
     268    BarnOwl::new_command( 'irc-stats' => mk_irc_command( \&cmd_stats ) );
     269
     270    BarnOwl::new_command(
     271        'irc-topic' => mk_irc_command( \&cmd_topic, REQUIRE_CHANNEL ),
     272        {
     273            summary => 'View or change the topic of an IRC channel',
     274            usage   => 'irc-topic [-a ALIAS] #channel [TOPIC]',
     275
     276            description => <<END_DESCR
     277
     278Without extra arguments, fetches and displays a given channel's topic.
     279
     280With extra arguments, changes the target channel's topic string. This
     281may require +o on some channels.
     282END_DESCR
     283        }
     284    );
     285
     286    BarnOwl::new_command(
     287        'irc-quote' => mk_irc_command( \&cmd_quote ),
     288        {
     289            summary => 'Send a raw command to the IRC servers.',
     290            usage   => 'irc-quote [-a ALIAS] TEXT',
     291
     292            description => <<END_DESCR
     293
     294Send a raw command line to an IRC server.
     295
     296This can be used to perform some operation not yet supported by
     297BarnOwl, or to define new IRC commands.
     298END_DESCR
     299        }
     300    );
     301}
     302
    126303
    127304$BarnOwl::Hooks::startup->add('BarnOwl::Module::IRC::startup');
    128305$BarnOwl::Hooks::shutdown->add('BarnOwl::Module::IRC::shutdown');
     306$BarnOwl::Hooks::getQuickstart->add('BarnOwl::Module::IRC::quickstart');
    129307
    130308################################################################################
Note: See TracChangeset for help on using the changeset viewer.