summaryrefslogtreecommitdiffstats
path: root/ksirc/autodcc.pl
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /ksirc/autodcc.pl
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/autodcc.pl')
-rw-r--r--ksirc/autodcc.pl71
1 files changed, 71 insertions, 0 deletions
diff --git a/ksirc/autodcc.pl b/ksirc/autodcc.pl
new file mode 100644
index 00000000..f075cbcd
--- /dev/null
+++ b/ksirc/autodcc.pl
@@ -0,0 +1,71 @@
+#
+#
+&print("*** Loading auto dcc...");
+
+%A_DCC = ();
+
+sub cmd_anick {
+ &getarg;
+ $A_DCC{$newarg} = 1;
+ &print("*\cbI\cb* Added $newarg to auto dcc");
+}
+
+&addcmd("anick");
+
+sub cmd_dnick {
+ &getarg;
+ delete $A_DCC{$newarg};
+ &print("*\cbI\cb* Removed $newarg from auto dcc");
+}
+
+&addcmd("dnick");
+
+sub cmd_lnick {
+ my $key;
+ my $str;
+ foreach $key (keys %A_DCC){
+ $str .= "$key ";
+ }
+ &print("*\cbI\cb* Nicks allowed to auto dcc: $str");
+}
+
+&addcmd("lnick");
+
+sub set_autoresume {
+ $set{'AUTORESUME'}="on", $a_autoresume=1 if $_[0] =~ /^on$/i;
+ $set{'AUTORESUME'}="off", $a_autoresume=0 if $_[0] =~ /^off$/i;
+}
+&addset("autoresume");
+$set{"AUTORESUME"}="on";
+$n_autoresume=1;
+
+my %A_AUTOSTART = ();
+
+sub hook_adcc_do {
+ my $cmd = shift;
+
+ if($cmd eq "SEND"){
+ if($A_DCC{$who} == 1){
+ my $host = shift;
+ my $dport = shift;
+ my $file = shift;
+ my $size = shift;
+ if(-e $file){
+ if(($n_autoresume == 1) && ((-s $file) < $size)){
+ &docommand("resume $who $file");
+ $A_AUTOSTART{$dport} = "dcc get $who $file";
+ }
+ else {
+ &tell("*E* Autodcc rejected. File exists and no auto resume, or size mismatch");
+ }
+ }
+ else {
+ &docommand("dcc get $who $file");
+ }
+ }
+ }
+}
+
+&addhook("dcc_request", "adcc_do");
+
+