/usr/share/ekg2/scripts/slownik.pl is in ekg2-scripting-perl 1:0.4~pre+20120506.1-14build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # YDP Dictionary bot based on socket, Michal 'GiM' Spadlinski
# requires sockydpdict :)
#
# SSS - short, small and simple
#
use Socket;
our $VERSION = "0.1";
our %EKG2 = (
authors => 'Michal Spadlinski',
name => 'slownikobot',
description => 'YDP slownik BOT',
license => 'GPL',
changed => 'Wed May 17 20:49:47 CEST 2006'
);
sub cotozaslowo
{
my $fname = "/tmp/ydpsock";
my $answer;
my $flags = 0;
my $maxlen = 4096;
$_ = shift;
socket (CLIENT, PF_UNIX, SOCK_STREAM, 0);
connect (CLIENT, sockaddr_un($fname))
or return 0;
defined (send(CLIENT, "$_\n", $flags))
or return 0;
recv (CLIENT, $answer, $maxlen, $flags)
or return 0;
return $answer;
}
#bindings for ekg2
sub handle_message {
#query_emit(NULL, "irc-protocol-message", &(sid), &(j->nick), &__msg, &isour, &xosd_to_us, &xosd_is_priv, &uid_full);
my ($session, $uid, $msg, $our, $n1, $n2, $n3) = @_;
$txt = $$msg;
return 1 if (! ($$session =~ /^irc:/));
# we don't respond to our own queries
return 1 if ($$our);
if ($txt =~ /(!ang) ([a-zA-Z ]*)/)
{
$z = cotozaslowo($2);
$z =~ s/\n{2,}/\n/g;
Ekg2::command("/msg $$uid $z");
return 0;
}
return 1
}
Ekg2::handler_bind('irc-protocol-message', 'handle_message');
1;
|