Skip to content

Instantly share code, notes, and snippets.

@rkulla
Last active September 26, 2015 15:07
Show Gist options
  • Save rkulla/1116155 to your computer and use it in GitHub Desktop.
Save rkulla/1116155 to your computer and use it in GitHub Desktop.
XChat Script for project collaboration over IRC
#!/usr/bin/perl -w
# I wrote this in ~2002 as a proof of concept
# Sample X-Chat script to make IRC project collaboration easier.
$password = "Pcollab_Password"; # Project password
@nicks = ("nick1", "nick2", "nick3"); # Array of nicks working on the project
IRC::register("Pcollab Script", "0.1", "", "");
IRC::print "Loading Pcollab Script...\n";
IRC::add_message_handler("PRIVMSG", "privmsg_handler");
IRC::add_command_handler("mmsg", "multi_msg_handler");
IRC::add_command_handler("mdcc", "multi_dcc_handler");
# Message only people that are part of the project with project info
# when they message you. They must enter the project password on the
# line when they msg you to recieve a msg back.
sub privmsg_handler {
my $line = shift(@_);
my $msg = "We're having a meeting tonight at 9:00. Be there!";
if ($line =~ /$password/i) {
$line =~ /:(.*)!(.*@.*) .*:(.*)/;
IRC::print "[$1] said: $3\n";
IRC::command "/msg $1 \0034autoreply:: $msg ::\003";
}
return 1;
}
# Sends a message to everyone on the project list at the same time. For example,
# to send the line:
# "Hey guys, I just put up a new screenshot: http://site.com/shot.jpg"
# Just type:
# /mmsg I just put up a new screenshot: http://site.com/shot.jpg
# everyone on the list of @nicks will receive that message.
sub multi_msg_handler {
my $msg = shift(@_);
IRC::print "\0034:: Sending msg... ::\003\n";
foreach $nick (@nicks) {
IRC::command("/msg $nick $msg");
}
return 1;
}
# Similar to the multi_msg_handler function, only this function sends a file
# to everyone on the list at the same time.
sub multi_dcc_handler {
my $file = shift(@_);
IRC::print "\0034:: Sending file... ::\003\n";
foreach $nick (@nicks) {
IRC::command("/dcc send $nick $file");
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment