diff --git a/scripts/autoop.pl b/scripts/autoop.pl index e3d4c65e..5f36f798 100644 --- a/scripts/autoop.pl +++ b/scripts/autoop.pl @@ -1,7 +1,8 @@ # /AUTOOP <*|#channel> [] -# For Irssi 0.7.96 and above (older versions had a few bugs) +# For Irssi 0.7.96 and above use Irssi; +use Irssi::Irc; my %opnicks, %temp_opped; @@ -45,14 +46,15 @@ sub cmd_autoop { sub autoop { my ($channel, $masks, @nicks) = @_; - my $nickrec; + my $server, $nickrec; + $server = $channel->values()->{'server'}; foreach $nickrec (@nicks) { $nick = $nickrec->values()->{'nick'}; $host = $nickrec->values()->{'host'}; if (!$temp_opped{$nick} && - Irssi::irc_masks_match($masks, $nick, $host)) { + $server->masks_match($masks, $nick, $host)) { $channel->command("/op $nick"); $temp_opped{$nick} = 1; } @@ -60,7 +62,8 @@ sub autoop { } sub event_massjoin { - my ($channel, @nicks) = @_; + my ($channel, $nicks_list) = @_; + my @nicks = @{$nicks_list}; return if (!$channel->values()->{'chanop'}); diff --git a/scripts/autorejoin.pl b/scripts/autorejoin.pl index 85331c5a..7954f121 100644 --- a/scripts/autorejoin.pl +++ b/scripts/autorejoin.pl @@ -5,6 +5,7 @@ # if you kick/get kicked all the time "just for fun" ... use Irssi; +use Irssi::Irc; sub event_rejoin_kick { my ($data, $server) = @_; diff --git a/scripts/hello.pl b/scripts/hello.pl index de53c3ab..b08a84b1 100644 --- a/scripts/hello.pl +++ b/scripts/hello.pl @@ -1,6 +1,7 @@ # "Hello, world!" script :) /hello sends "Hello, world!" to use Irssi; +use Irssi::Irc; sub cmd_hello { my ($data, $server, $channel) = @_; diff --git a/scripts/mlock.pl b/scripts/mlock.pl index 82bea7b0..01d08b45 100644 --- a/scripts/mlock.pl +++ b/scripts/mlock.pl @@ -1,4 +1,4 @@ -# /MLOCK - for Irssi 0.7.29 and above +# /MLOCK - for Irssi 0.7.96 and above # # Locks the channel mode to , if someone else tries to change the mode # Irssi will automatically change it back. +k and +l are a bit special since @@ -6,6 +6,7 @@ # mode to "+ntlk", Irssi will allow all +k and +l (or -lk) mode changes. use Irssi; +use Irssi::Irc; sub cmd_mlock { my ($data, $server) = @_; @@ -26,7 +27,7 @@ sub mlock_check_mode { return if (!$keep_mode); # old channel mode - $oldmode = $channel->get_mode(); + $oldmode = $channel->values()->{'mode'}; $oldmode =~ s/^([^ ]*).*/\1/; $oldkey = $channel->values()->{'key'}; $oldlimit = $channel->values()->{'limit'}; diff --git a/scripts/privmsg.pl b/scripts/privmsg.pl index 999bd213..9fdcdcb1 100644 --- a/scripts/privmsg.pl +++ b/scripts/privmsg.pl @@ -1,12 +1,13 @@ # listen PRIVMSGs - send a notice to yourself when your nick is meantioned use Irssi; +use Irssi::Irc; sub event_privmsg { my ($data, $server, $nick, $address) = @_; my ($target, $text) = $data =~ /^(\S*)\s:(.*)/; - return if (!Irssi::is_channel($target)); + return if (!$server->ischannel($target)); $mynick = $server->values()->{'nick'}; return if ($text !~ /\b$mynick\b/); diff --git a/scripts/quitmsg.pl b/scripts/quitmsg.pl index 6e296755..3d8ce289 100644 --- a/scripts/quitmsg.pl +++ b/scripts/quitmsg.pl @@ -1,6 +1,7 @@ # Quit with a random quit message read from ~/.irssi/irssi.quit use Irssi; +use Irssi::Irc; $quitfile = "$ENV{HOME}/.irssi/irssi.quit"; diff --git a/scripts/realname.pl b/scripts/realname.pl index 1150d5e2..1b48f044 100644 --- a/scripts/realname.pl +++ b/scripts/realname.pl @@ -1,6 +1,7 @@ # /RN - display real name of nick use Irssi; +use Irssi::Irc; sub cmd_realname { my ($data, $server, $channel) = @_; diff --git a/src/perl/common/Server.xs b/src/perl/common/Server.xs index c3078485..d7b49eee 100644 --- a/src/perl/common/Server.xs +++ b/src/perl/common/Server.xs @@ -101,6 +101,48 @@ CODE: (char *) SvPV(ST(n), n_a), (char *) SvPV(ST(n+1), n_a), (int) SvIV(ST(n+2))); } +void +channels_join(server, data, automatic) + Irssi::Server server + char *data + int automatic +CODE: + server->channels_join(server, data, automatic); + +int +isnickflag(server, flag) + Irssi::Server server + char flag +CODE: + RETVAL = server->isnickflag(flag); +OUTPUT: + RETVAL + +int +ischannel(server, flag) + Irssi::Server server + char flag +CODE: + RETVAL = server->ischannel(flag); +OUTPUT: + RETVAL + +char * +get_nick_flags(server) + Irssi::Server server +CODE: + RETVAL = (char *) server->get_nick_flags(); +OUTPUT: + RETVAL + +void +send_message(server, target, msg) + Irssi::Server server + char *target + char *msg +CODE: + server->send_message(server, target, msg); + #******************************* MODULE = Irssi PACKAGE = Irssi::Connect PREFIX = server_ #******************************* diff --git a/src/perl/common/Window.xs b/src/perl/common/Window.xs index 7a516020..579fef71 100644 --- a/src/perl/common/Window.xs +++ b/src/perl/common/Window.xs @@ -52,7 +52,7 @@ CODE: signal_emit("send command", 3, cmd, server, item); void -printtext(server, channel, level, str) +printtext(server, channel, str, level) Irssi::Server server char *channel int level @@ -141,3 +141,15 @@ command(item, cmd) char *cmd CODE: signal_emit("send command", 3, cmd, item->server, item); + +#******************************* +MODULE = Irssi PACKAGE = Irssi::Channel +#******************************* + +void +print(channel, str, level=MSGLEVEL_CLIENTNOTICE) + Irssi::Channel channel + int level + char *str +CODE: + printtext(channel->server, channel->name, level, str); diff --git a/src/perl/irc/IrcServer.xs b/src/perl/irc/IrcServer.xs index 5f609605..2d4108e9 100644 --- a/src/perl/irc/IrcServer.xs +++ b/src/perl/irc/IrcServer.xs @@ -18,6 +18,29 @@ char * irc_server_get_channels(server) Irssi::Irc::Server server +void +send_raw(server, cmd) + Irssi::Irc::Server server + char *cmd +CODE: + irc_send_cmd(server, cmd); + +void +send_raw_now(server, cmd) + Irssi::Irc::Server server + char *cmd +CODE: + irc_send_cmd_now(server, cmd); + +void +send_raw_split(server, cmd, nickarg, max_nicks) + Irssi::Irc::Server server + char *cmd + int nickarg + int max_nicks +CODE: + irc_send_cmd_split(server, cmd, nickarg, max_nicks); + MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Connect PREFIX = irc_server_ void