html/akftp.pl
1 ###########################################################################
2 # ak FTP-Ad v1.4
3 # Copyright (C) 2003 ak
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (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 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 # 02111-1307, USA.
19 # Or check out here, eh ;) -> http://www.gnu.org/licenses/gpl.html //ak
20 ###########################################################################
21
22 # code follows .. nothing to do here for you,
23 # just load the script into irssi with /script load akftp.pl
24 # and enter /akftp for more information
25 #############################################################
26
27 use strict;
28 use Irssi 20021117.1611 ();
29 use vars qw($VERSION %IRSSI);
30 $VERSION = "1.4";
31 %IRSSI = (
32 authors => "ak",
33 contact => "ocb23\@freenet.removethis.de",
34 name => "ak FTP-Ad",
35 description => "Full configurable FTP advertiser for Irssi",
36 license => "GPLv2",
37 url => "http://members.tripod.com.br/archiv/",
38 );
39
40
41 use Irssi qw(
42 settings_get_bool settings_add_bool
43 settings_get_str settings_add_str
44 settings_get_int settings_add_int
45 print
46 );
47
48 sub cmd_list {
49 my ($server, $msg, $nick, $mask, $target) = @_;
50 my ($c1, $c2, $trigger, $targets);
51 $trigger=settings_get_str('akftp_trigger');
52 $targets=settings_get_str('akftp_channels');
53
54 if (!settings_get_bool('akftp_enable_add')) { return 0 }
55 if(!($target =~ $targets)) { return 0 }
56 elsif ($msg=~/^$trigger/){
57 $c1=settings_get_str('akftp_color1');
58 $c2=settings_get_str('akftp_color2');
59 $server->command("^NOTICE ".$nick." ".$c1."=(".$c2."FTP Online".$c1.")= \@(".
60 $c2.settings_get_str('akftp_host').$c1.") Port:(".$c2.settings_get_str('akftp_port').
61 $c1.") Login:(".$c2.settings_get_str('akftp_login').$c1.") Pass:(".
62 $c2.settings_get_str('akftp_pass').$c1.") Quicklink: ".$c2.
63 "ftp://".settings_get_str('akftp_login').":".settings_get_str('akftp_pass')."\@".
64 settings_get_str('akftp_host').":".settings_get_str('akftp_port')."/".
65 $c1." Notes:(".$c2.settings_get_str('akftp_notes').$c1.")");
66 # Irssi::signal_stop();
67 }
68 }
69
70 sub cmd_akftp {
71 print("%r.--------------------<%n%_ak FTP-Ad for Irssi%_%r>--------------------<");
72 print("%r|%n Configure the script with %_/set%_ commands, to see all values,");
73 print("%r|%n you can type \"%_/set akftp%_\".");
74 print("%r|%n You can configure multiple chans by separating them with %_|%_");
75 print("%r|%n You have to specify the colors with \"%_CTRL+C##%_\". where %_##%_");
76 print("%r|%n must be numbers between %_00%_ and %_15%_! Prefix 0-9 with a zero!");
77 print("%r|%n Note that \"%_/set akftp%_\" will show empty variables for colors,");
78 print("%r|%n even if they are already set.");
79 print("%r`------------------------------------------------------------->");
80 }
81
82 settings_add_bool('akftp', 'akftp_enable_add', 0);
83 settings_add_str('akftp', 'akftp_login', "username");
84 settings_add_str('akftp', 'akftp_pass', "password");
85 settings_add_str('akftp', 'akftp_host', "your.dyndns-or-static.ip");
86 settings_add_str('akftp', 'akftp_notes', "Don't hammer!");
87 settings_add_str('akftp', 'akftp_channels', "#chan1|#chan2");
88 settings_add_int('akftp', 'akftp_port', "21");
89 settings_add_str('akftp', 'akftp_color1', "\00303");
90 settings_add_str('akftp', 'akftp_color2', "\00315");
91 settings_add_str('akftp', 'akftp_trigger', "!list");
92
93 Irssi::signal_add_last('message public', 'cmd_list');
94 Irssi::command_bind('akftp', 'cmd_akftp');
95
96 #EOF