Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

XChat (IRC) XDCC script

by mephit (Scribe)
on Dec 14, 2001 at 09:01 UTC ( #131900=sourcecode: print w/replies, xml ) Need Help??
Category: Miscellaneous
Author/Contact Info Mephit a.k.a. J. Kufrovich
Description: This is a script for the XChat IRC client (which happens to use Perl as a scripting language, huzzah!) to handle xdcc stuff: sending files to others automatically as they're requested. The script is mostly subroutines that are completely independent of one another. It does What I Expect, and I know the IRC:: bits are right, but I'm wondering if the Perl can be made any more efficient somehow? I'd appreciate any feedback on this. The code is linked to below. This is my longest Perl program so far, and the first I'm showing to the general public, so please be gentle, OK? Thanks for any tips, folks.
The code is right here.
Replies are listed 'Best First'.
Re: XChat (IRC) XDCC script
by Anonymous Monk on Jan 16, 2004 at 00:28 UTC
    the url dosent exist
Re: XChat (IRC) XDCC script
by Anonymous Monk on Jul 18, 2004 at 23:48 UTC
    if a man speaks in a forrest where no woman is around to hear is he still wrong?
Re: XChat (IRC) XDCC script
by vladb (Vicar) on Dec 19, 2001 at 22:07 UTC
    Hi, I should say your script looks pretty good ;-). Sorry, I didn't have much time to _really_ study into it, but here's what I've found after a quick scan:

    In your xqsend() subroutine, you have the following:
    if ($_[0]) { my $user_index = $_[0]; $user = $xdccqueue[$user_index - 1]{user}; } else { $user = $xdccqueue[0]{user}; #IRC::print("$CX Checking for$CB $user$CX from queue... $CO\n"); }
    First, you don't need to initialize the $user_index variable to simply store the value of the first subroutine argument, considering that the only place you use it is in the line immediately below its initialization.
    Therefore, I'd propose to exchange your if/else block for this:
    $user = $xdccqueue[(($_[0] || 1) - 1)]{user};
    Or, better yet, just use this:
    $user = $xdccqueue[$_[0]]{user};
    (qw(foo bar))[$_[0]]
    would still yield 'foo' when @_ is empty (therefore, $_[0] is undef).

    "There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://131900]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2023-01-30 15:00 GMT
Find Nodes?
    Voting Booth?

    No recent polls found