1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-15 04:28:09 -04:00
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@976 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-12-06 05:42:13 +00:00 committed by cras
parent bb594d2aa6
commit d22ca4efe5
8 changed files with 24 additions and 27 deletions

View File

@ -1,8 +1,6 @@
# /AUTOOP <*|#channel> [<nickmasks>] # /AUTOOP <*|#channel> [<nickmasks>]
# For Irssi 0.7.96 and above
use Irssi; use Irssi;
use Irssi::Irc;
my %opnicks, %temp_opped; my %opnicks, %temp_opped;
@ -48,10 +46,10 @@ sub autoop {
my ($channel, $masks, @nicks) = @_; my ($channel, $masks, @nicks) = @_;
my $server, $nickrec; my $server, $nickrec;
$server = $channel->values()->{'server'}; $server = $channel->{server};
foreach $nickrec (@nicks) { foreach $nickrec (@nicks) {
$nick = $nickrec->values()->{'nick'}; $nick = $nickrec->{nick};
$host = $nickrec->values()->{'host'}; $host = $nickrec->{host};
if (!$temp_opped{$nick} && if (!$temp_opped{$nick} &&
$server->masks_match($masks, $nick, $host)) { $server->masks_match($masks, $nick, $host)) {
@ -65,12 +63,12 @@ sub event_massjoin {
my ($channel, $nicks_list) = @_; my ($channel, $nicks_list) = @_;
my @nicks = @{$nicks_list}; my @nicks = @{$nicks_list};
return if (!$channel->values()->{'chanop'}); return if (!$channel->{chanop});
undef %temp_opped; undef %temp_opped;
# channel specific # channel specific
my $masks = $opnicks{$channel->values()->{'name'}}; my $masks = $opnicks{$channel->{name}};
autoop($channel, $masks, @nicks) if ($masks); autoop($channel, $masks, @nicks) if ($masks);
# for all channels # for all channels

View File

@ -8,15 +8,17 @@ use Irssi;
use Irssi::Irc; use Irssi::Irc;
sub event_rejoin_kick { sub event_rejoin_kick {
my ($data, $server) = @_; my ($server, $data) = @_;
my ($channel, $nick) = split(/ +/, $data); my ($channel, $nick) = split(/ +/, $data);
return if ($server->values()->{'nick'} ne $nick); return if ($server->{nick} ne $nick);
# check if channel has password # check if channel has password
$chanrec = $server->channel_find($channel); $chanrec = $server->channel_find($channel);
$password = $chanrec->values()->{'key'} if ($chanrec); $password = $chanrec->{key} if ($chanrec);
# We have to use send_raw() because the channel record still
# exists and irssi won't even try to join to it with command()
$server->send_raw("JOIN $channel $password"); $server->send_raw("JOIN $channel $password");
} }

View File

@ -1,16 +1,15 @@
# /CLONES - display real name of nick # /CLONES - display real name of nick
use Irssi; use Irssi;
use Irssi::Irc;
sub cmd_clones { sub cmd_clones {
my ($data, $server, $channel) = @_; my ($data, $server, $channel) = @_;
my %hostnames, $host, @nicks, $nick; my %hostnames, $host, @nicks, $nick;
@nicks = $channel->nicklist_getnicks(); @nicks = $channel->nicks();
foreach $nick (@nicks) { foreach $nick (@nicks) {
$hostnames{$nick->values()->{'host'}}++; $hostnames{$nick->{host}}++;
} }
$channel->print("Clones:"); $channel->print("Clones:");

View File

@ -1,7 +1,6 @@
# "Hello, world!" script :) /hello <nick> sends "Hello, world!" to <nick> # "Hello, world!" script :) /hello <nick> sends "Hello, world!" to <nick>
use Irssi; use Irssi;
use Irssi::Irc;
sub cmd_hello { sub cmd_hello {
my ($data, $server, $channel) = @_; my ($data, $server, $channel) = @_;

View File

@ -1,4 +1,4 @@
# /MLOCK <channel> <mode> - for Irssi 0.7.96 and above # /MLOCK <channel> <mode>
# #
# Locks the channel mode to <mode>, if someone else tries to change the mode # Locks the channel mode to <mode>, if someone else tries to change the mode
# Irssi will automatically change it back. +k and +l are a bit special since # Irssi will automatically change it back. +k and +l are a bit special since
@ -21,16 +21,16 @@ sub mlock_check_mode {
my ($server, $channame) = @_; my ($server, $channame) = @_;
$channel = $server->channel_find($channame); $channel = $server->channel_find($channame);
return if (!channel || !$channel->values()->{'chanop'}); return if (!channel || !$channel->{chanop});
$keep_mode = $keep_channels{$channame}; $keep_mode = $keep_channels{$channame};
return if (!$keep_mode); return if (!$keep_mode);
# old channel mode # old channel mode
$oldmode = $channel->values()->{'mode'}; $oldmode = $channel->{mode};
$oldmode =~ s/^([^ ]*).*/\1/; $oldmode =~ s/^([^ ]*).*/\1/;
$oldkey = $channel->values()->{'key'}; $oldkey = $channel->{key};
$oldlimit = $channel->values()->{'limit'}; $oldlimit = $channel->{limit};
# get the new channel key/limit # get the new channel key/limit
@newmodes = split(/ /, $keep_mode); $keep_mode = $newmodes[0]; @newmodes = split(/ /, $keep_mode); $keep_mode = $newmodes[0];
@ -93,12 +93,12 @@ sub mlock_check_mode {
} }
if ($modecmd ne "") { if ($modecmd ne "") {
$channel->values()->{'server'}->command("/mode $channame $modecmd$extracmd"); $channel->{server}->command("/mode $channame $modecmd$extracmd");
} }
} }
sub mlock_mode_changed { sub mlock_mode_changed {
my ($data, $server) = @_; my ($server, $data) = @_;
my ($channel, $mode) = split(/ /, $data, 2); my ($channel, $mode) = split(/ /, $data, 2);
mlock_check_mode($server, $channel); mlock_check_mode($server, $channel);
@ -107,7 +107,7 @@ sub mlock_mode_changed {
sub mlock_synced { sub mlock_synced {
my $channel = $_[0]; my $channel = $_[0];
mlock_check_mode($channel->values()->{'server'}, $channel->values()->{'name'}); mlock_check_mode($channel->{server}, $channel->{name});
} }
Irssi::command_bind('mlock', '', 'cmd_mlock'); Irssi::command_bind('mlock', '', 'cmd_mlock');

View File

@ -1,15 +1,14 @@
# listen PRIVMSGs - send a notice to yourself when your nick is meantioned # listen PRIVMSGs - send a notice to yourself when your nick is meantioned
use Irssi; use Irssi;
use Irssi::Irc;
sub event_privmsg { sub event_privmsg {
my ($data, $server, $nick, $address) = @_; my ($server, $data, $nick, $address) = @_;
my ($target, $text) = $data =~ /^(\S*)\s:(.*)/; my ($target, $text) = $data =~ /^(\S*)\s:(.*)/;
return if (!$server->ischannel($target)); return if (!$server->ischannel($target));
$mynick = $server->values()->{'nick'}; $mynick = $server->{nick};
return if ($text !~ /\b$mynick\b/); return if ($text !~ /\b$mynick\b/);
$server->command("/notice $mynick In channel $target, $nick!$address said: $text"); $server->command("/notice $mynick In channel $target, $nick!$address said: $text");

View File

@ -25,7 +25,7 @@ sub cmd_quit {
@servers = Irssi::servers; @servers = Irssi::servers;
foreach $server (@servers) { foreach $server (@servers) {
$server->command("/disconnect ".$server->values()->{'tag'}." $quitmsg"); $server->command("/disconnect ".$server->{tag}." $quitmsg");
} }
} }

View File

@ -24,7 +24,7 @@ sub cmd_realname {
} }
sub event_rn_whois { sub event_rn_whois {
my ($num, $nick, $user, $host, $empty, $realname) = split(/ +/, $_[0], 6); my ($num, $nick, $user, $host, $empty, $realname) = split(/ +/, $_[1], 6);
$realname =~ s/^://; $realname =~ s/^://;
Irssi::print("%_$nick%_ is $realname"); Irssi::print("%_$nick%_ is $realname");