# NOTE -- This file is generated by running make-js-interfaces.pl package konqueror; use strict; use vars qw/@ISA $standardheader/; $standardheader = < == Released under the GNU GPL --> EOF use default; @ISA = qw/default/; my %colours = ( '00' => '#FFFFFF', '01' => '#000000', '02' => '#0000FF', '03' => '#008000', '04' => '#FF0000', '05' => '#800000', '06' => '#800080', '07' => '#FF6600', '08' => '#FFFF00', '09' => '#00FF00', '10' => '#008080', '11' => '#00FFFF', '12' => '#0000FF', '13' => '#FF00FF', '14' => '#808080', '15' => '#C0C0C0'); my %options = ( timestamp => { type => 'toggle', info => 'Display a timestamp next to each message', img => 'time.gif' }, font => { type => 'select', options => [qw/serif sans-serif fantasy cursive monospace/, 'Arial Black', 'Comic Sans MS', 'Fixedsys', 'Tahoma', 'Verdana'], info => 'The font that messages are displayed in', img => 'font.gif' }, shownick => { type => 'toggle', info => 'Show your nickname next to the text entry box', img => 'entry.gif' }, smilies => { type => 'toggle', info => 'Convert smilies into pictures', img => 'smile.gif' }, scrollback => { type => 'toggle', info => 'Store all scrollback data (uses more memory)', img => 'scrollback.gif', }, 'actsound' => { type => "toggle", info => "Play a sound when activity directed at you occurs", img => 'actsound.gif', }, 'joinsound' => { type => "toggle", info => "Play a sound when some one joins a channel", img => 'joinsound.gif', }, ); my(%output_status, %output_none, %output_active); sub new { my($class,$event, $timer, $config, $icookies) = @_; my $self = bless {}, $class; tie %$self, 'IRC::UniqueHash'; my $tmp=''; for(keys %$icookies) { $tmp .= "$_: " . _escapejs($icookies->{$_}) . ', '; } $tmp =~ s/, $//; _out('parent.options = { ' . $tmp . '};'); $event->add('user add', code => \&useradd); $event->add('user del', code => \&userdel); $event->add('user change nick', code => \&usernick); $event->add('user change', code => \&usermode); $event->add('user self', code => \&mynick); $event->add('user 005', code => sub { _func_out('prefix',$_[1])}); $event->add('user connected', code => sub { _out('parent.connected = 1;') }); $self->add('Status', 0); _func_out('witemnospeak', 'Status'); _func_out('fontset', $icookies->{font}) if exists $icookies->{font}; _func_out('enable_sounds') if ((exists $icookies->{actsound} || exists $icookies->{joinsound}) && ($icookies->{actsound} || $icookies->{joinsound})); if(exists $::config->{'output status'}) { @output_status{split /,\s*/, $::config->{'output status'}} = 1; } if(exists $::config->{'output none'}) { @output_none{split /,\s*/, $::config->{'output none'}} = 1; } if(exists $::config->{'output active'}) { @output_active{split /,\s*/, $::config->{'output active'}} = 1; } return $self; } sub end { _out('parent.connected = 0;'); } sub _out { unless(print "\r\n") { $::needtodie++; } } sub _func_out { my($func,@rest) = @_; @rest = map(ref $_ eq 'ARRAY' ? _outputarray($_) : _escapejs($_), @rest); if($func eq 'witemaddtext') { return 'parent.' . $func . '(' . _jsp(@rest) . ');'; } _out('parent.' . $func . '(' . _jsp(@rest) . ');'); } sub _escapejs { my $in = shift; return "''" unless defined $in; $in =~ s/\\/\\\\/g; $in =~ s/'/\\'/g; $in =~ s/<\/script/<\\\/\\script/g; if(defined $_[0]) { return "$_[0]$in$_[0]"; } return '\'' . $in . '\''; } sub _escapehtml { my $in = shift; return "''" unless defined $in; $in =~ s//>/g; $in =~ s/"/"/g; return $in; } sub _jsp { return join(', ', @_); } sub _outputarray { my $array = shift; return '[' . _jsp(map(_escapejs($_), @$array)) . ']'; } sub useradd { my($event, $nicks, $channel) = @_; _func_out('channeladdusers', $channel, $nicks); } sub userdel { my($event, $nick, $channels) = @_; _func_out('channelsdeluser', $channels, $nick); } sub usernick { my($event,$old,$new,$channels) = @_; _func_out('channelsusernick', $old, $new); } sub usermode { my($event,$nick, $channel, $action, $type) = @_; _func_out('channelusermode', $channel, $nick, $action, $type); } sub mynick { my($event, $nick) = @_; _func_out('mynick', $nick); } sub exists { return 1 if defined &{__PACKAGE__ . '::' . $_[1]}; } sub query { return 1; } sub style { my($self, $cgi, $config) = @_; my $style = $cgi->{style} || 'default'; $cgi->{style} =~ s/[^a-z]//gi; open(STYLE, "; close(STYLE); } sub makeline { my($self, $info, $html) = @_; my $target = defined $info->{target} ? $info->{target} : 'Status'; if(ref $target eq 'ARRAY') { my %tmp = %$info; my $text = ''; for(@$target) { $tmp{target} = $_; $text .= $self->makeline(\%tmp, $html) . "\r\n"; } return $text; } my $out = ""; if(not exists $self->{$target}) { if(defined $info && ref $info && exists $info->{create} && $info->{create}) { $self->add($target, $info->{type} eq 'join' ? 1 : 0); }elsif($target ne '-all') { $target = 'Status'; } }elsif($info->{type} eq 'join') { $out = "parent.joinsound();"; } $info->{type} =~ s/^(\w+ \w+) .*/$1/; return if exists $output_none{$info->{type}}; $target = "Status" if exists $output_status{$info->{type}}; $target = "-active" if exists $output_active{$info->{type}}; if($info->{style}) { $html = "{style}\">$html"; } return $out . _func_out('witemaddtext', $target, $html . '
', $info->{activity} || 0, 0); } sub lines { my($self, @lines) = @_; _out(join("\r\n", @lines)."\r\nparent.witemredraw();"); print "\r\n"; } sub header { my($self, $cgi, $config, $fg, $bg) = @_; _func_out('maincolor', $fg, $bg); } sub error { my($self,$message) = @_; $self->lines($self->makeline({ target => 'Status'}, $message)); _func_out('disconnected'); } sub add { my($self,$add,$channel) = @_; return if not defined $add; $self->{$add}++; _func_out('witemadd', $add, $channel); _func_out('witemchg', $add) if $channel; } sub del { my($self, $del) = @_; return if not defined $del; _func_out('witemdel', $del); return if not exists $self->{$del}; delete($self->{$del}); } sub clear { my($self, $window) = @_; _func_out('witemclear', $window); } sub active { my($self, $window) = @_; _func_out('witemchg', $window); } sub smilie { # js runs in fmain. (XXX: doesn't actually work?) return '' . $_[2] . ''; } sub link { shift; # object return "$_[1]"; } sub frameset { my($self, $scriptname, $config, $random, $out, $interface, $style) = @_; print < CGI:IRC - Loading This interface requires a browser that supports frames and javascript. EOF } sub blank { return ''; } sub ctcpping { my($self, $nick, $params) = @_; _func_out('sendcmd',"/ctcpreply $nick PING $params"); 1; } sub ping { 1; } sub sendping { _func_out('sendcmd',"/noop"); } sub help { my($self,$config) = @_; my $help = <

CGI:IRC Help

Interface

The interface of CGI:IRC is very similar to a standard graphical IRC client, it should be easy to use if you are familiar with IRC clients. Along the top is a list of tabs, there will be a tab here for each channel you are in and each query (private message) you have open. To close a window click the X button on the far right of the tab list.
The userlist is on the right, when in a channel tab it will show a list of all the people in that channel. Double clicking a nickname will open a query with that user or perform whichever other action you select in the select box at the bottom.
The text entry box should be simple, the little arrow to the right of the text entry area shows a toolbar that allows easy typing of colour, bold and underline. It is also where you enter all the commands.

Commands

Commands begin with / and should be familiar to anyone who has used IRC before - here is a quick summary of the most useful commands.
/meThis turns the text after /me into an action, eg: /me looks around.
/joinJoins the specified channel. eg: /join #cgiirc
/listLists all the channels on the network (this outputs a lot of information).
/partLeaves the current channel (same as clicking the X while in the channel).
/quitQuits IRC totally (same as clicking X in Status window).
/msgSends a private message to a user. eg: /msg someone Hi
/whoisGives some information about a user.

Options

The options window lets you change some settings in CGI:IRC. Hopefully it should be fairly self explanatory, change a setting and it should take effect immediately.

Keyboard shortcuts

There are several shortcuts to help make using CGI:IRC nicer.
TabWill autocomplete a nickname or channel.
Ctrl+number / Alt+numberWill go to that number window if you number the windows from the left (Status = 1 and so on).
Ctrl+BWrite "%B" for bold text.
Ctrl+CWrite "%C" for colored text.
Cursor Up/DownMove in the command history.

About CGI:IRC

CGI:IRC is written in Perl by David Leadbeater with help from lots of people. See the website for more information. EOF $help =~ s/[\n\r]/ /g; _func_out('doinfowin', '-Help', $help); } sub setoption { my($self, $name, $value) = @_; _func_out('setoption', $name, $value); $self->options({}, {}, $main::config) } sub options { my($self, $cgi, $irc, $config) = @_; $config = $irc unless ref $config; my $ioptions = $main::ioptions; my $out = "CGI:IRC Options

Options

These options affect the appearence of CGI:IRC, they will stay between sessions provided cookies are turned on.
"; for my $option(sort keys %options) { my $o = $options{$option}; my $value = defined $ioptions->{$option} ? $ioptions->{$option} : ''; $out .= ""; } $out .= "
" . (exists $o->{img} ? ""; if($o->{type} eq 'toggle') { $out .= ""; }elsif($o->{type} eq 'select') { $out .= ""; }else{ $out .= ""; } $out .= "
close "; $out =~ s/\n//g; _func_out('doinfowin', '-Options', $out); } sub say { my($self) = @_; return 'ok'; } sub fwindowlist { my($self, $cgi, $config) = @_; my $string; for(keys %$cgi) { next if $_ eq 'item'; $string .= main::cgi_encode($_) . '=' . main::cgi_encode($cgi->{$_}).'&'; } $string =~ s/\&$//; print $standardheader; print q~
EOF } sub fmain { my($self, $cgi, $config) = @_; print < EOF } sub fuserlist { my($self, $cgi, $config) = @_; print <
No channel
EOF } sub fform { my($self, $cgi, $config) = @_; print <
EOF print < EOF } 1;