File: subtestbot.plz

package info (click to toggle)
opendchub 0.7.15-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,524 kB
  • ctags: 482
  • sloc: ansic: 10,962; sh: 1,960; makefile: 31
file content (129 lines) | stat: -rw-r--r-- 2,890 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# This scripts tests the different subs that are fired from the hub. To run it,
# rename the filename so that it ends with '.pl'.

$botname = "SubTestBot";

sub main()
{
    odch::register_script_name($botname);
}
    
sub new_user_connected()
{
    my($user) = @_;
    my($host) = odch::get_hostname($user);
    my($ip) = odch::get_ip($user);
    odch::data_to_all("<$botname> $user logged in from $host. Ip is $ip|");
}

sub data_arrival()
{
    my($user, $data) = @_;
    odch::data_to_user($user, 
	       "\$To: $user From: $botname \$<$botname> You sent: $data");
#  We don't need to end the command with a '|' here, since the data ends with
#  a '|' anyway.
}

sub added_perm_ban()
{
    my($entry) = @_;
    odch::data_to_all("<$botname> Added banentry: $entry|");
}

sub added_perm_allow()
{
    my($entry) = @_;
    odch::data_to_all("<$botname> Added allowentry: $entry|");
}

sub added_registered_user()
{
    my($nick) = @_;
    odch::data_to_all("<$botname> Added registered user: $nick|");    
}

sub added_multi_hub()
{
    my($hub, $port) = @_;
    odch::data_to_all("<$botname> Added multihub: $hub:$port|");
}

sub started_redirecting()
{
    my($host) = @_;
# 'print' prints to stdout, so only use print when running in console with
# the '-d' option, and only use it (both 'print' and '-d') for testing purpose!
    print "redirected to $host\n";
}

sub mass_message()
{
    my($mess) = @_;
    odch::data_to_all("<$botname> Mass-Message: $mess|");
}

sub started_serving()
{
# Read comment above about 'print'.
    print "From: $botname: Started serving\n";
}

sub multi_hub_data_chunk_in()
{
    my($mess) = @_;
    odch::data_to_all("<$botname> Multihub data: $mess|");
}

sub attempted_connection()
{
    my($host) = @_;
    odch::data_to_all("<$botname> $host attempted connection.|");
}

sub op_admin_connected()
{
    my($user) = @_;
    my($host) = odch::get_hostname($user);
    my($ip) = odch::get_ip($user);
    odch::data_to_all("<$botname> Op Admin $user logged in from $host. Ip is $ip|");
}

sub op_connected()
{
    my($user) = @_;
    my($host) = odch::get_hostname($user);
    my($ip) = odch::get_ip($user);
    odch::data_to_all("<$botname> OP $user logged in from $host. Ip is $ip|");
}

sub reg_user_connected()
{
    my($user) = @_;
    my($host) = odch::get_hostname($user);
    my($ip) = odch::get_ip($user);
    odch::data_to_all("<$botname> Reg user $user logged in from $host. Ip is $ip|");
}

sub user_disconnected()
{
    my($nick) = @_;
    odch::data_to_all("<$botname> $nick diconnected.|");
}
 
sub hub_timer()
{
     odch::data_to_all("<$botname> Hub timer test.|");
}

sub added_temp_ban()
{
     my($entry, $timep) = @_;
     odch::data_to_all("<$botname> $entry is banned for $timep seconds.|");
}
	
sub added_temp_allow()
{
    my($entry, $timep) = @_;
    odch::data_to_all("<$botname> $entry is allowed for $timep seconds.|");
}