File: cmd

package info (click to toggle)
konversation 1.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 17,080 kB
  • ctags: 4,900
  • sloc: cpp: 45,134; perl: 475; python: 397; sh: 211; makefile: 9
file content (30 lines) | stat: -rwxr-xr-x 676 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env perl
# Copyright (C) 2004 by İsmail Dönmez
# Licensed under GPL v2 or later at your option

$SERVER= shift;
$TARGET= shift;

my $i;
my $command;

if( $ARGV[0] eq "yes" ){
    exec 'qdbus', 'org.kde.konversation', '/irc', 'error', 'Requested command is not executed!';
}

foreach $word (@ARGV) {
    $command = $command." ".$word;
}

$ARG_MESSAGE = `exec $command`;

foreach $entry (split(/\n/, $ARG_MESSAGE)) {
    chomp $entry;
    $i=1;
    $entry =~ s/^\//\/\//;
    system 'qdbus', 'org.kde.konversation', '/irc', 'say', $SERVER, $TARGET, $entry;
}

unless($i) {
    exec 'qdbus', 'org.kde.konversation', '/irc', 'error', "Command @ARGV doesn't exist";
}