Begin on API::IRC.

This commit is contained in:
Elijah Perrault committed 2011-01-19 15:40:40 -07:00
1 parent 3573c7339b
commit 03e0857713
2 files changed
+33

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
==================================================================
* Begin on API::IRC.
* Parse PING and Numeric:001.
* Begin on the IRC parser.
* Added sockets, support for multiple asynchronous sockets.
+32
View File
@@ -0,0 +1,32 @@
# Auto IRC Bot. An advanced, lightweight and powerful IRC bot.
# Copyright (C) 2010-2011 Xelhua Development Team (doc/CREDITS)
# This program is free software; rights to this code are stated in doc/LICENSE.
# IRC API subroutines.
package API::IRC;
use strict;
use warnings;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(cjoin cpart);
# Join a channel.
sub cjoin {
my ($svr, $chan) = @_;
Auto::socksnd($svr, "JOIN $chan");
}
# Part a channel.
sub cpart {
my ($svr, $chan, $reason) = @_;
if (defined $reason) {
Auto::socksnd($svr, "PART $chan :$reason");
}
else {
Auto::socksnd($svr, "PART $chan :Leaving");
}
}