1# Opnotice script, by Terje Tjeldnes (terje@darkrealm.no)
2# Compatible with bahamut (DALnet ircd) or any other ircd with
3# support for the /notice @#channel syntax.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# The complete text of the GNU General Public License can be found
16# on the World Wide Web: <URL:http://www.gnu.org/licenses/gpl.html>
17#
18# Commands: /o <text> in a channel.
19
20use strict;
21use Irssi;
22
23use vars qw($VERSION %IRSSI);
24
25$VERSION = "0.1";
26
27%IRSSI = (
28	authors	=> "Terje \"xerath\" Tjeldnes",
29	contact	=> "terje\@darkrealm.no",
30	name	=> "Opnotice",
31	url	=> "http://palantir.darkrealm.no/opnotice.pl",
32	license	=> "GNU GPL v2",
33	changed	=> "Thu Jul 25 00:19:09 CEST 2002"
34);
35
36
37sub cmd_opnotice {
38my ($data, $server, $witem) = @_;
39
40if (!$server || !$server->{connected}) {
41      Irssi::print("Not connected to server");
42      return;
43}
44
45if ($witem && ($witem->{type} eq "CHANNEL")) {
46	chomp ($data);
47	$witem->command("NOTICE \@".$witem->{name}." $data");
48	}
49	else {
50		Irssi::print("Not in a channel, aborted");
51	}
52}
53
54Irssi::command_bind('o', 'cmd_opnotice');
55
56
57