From 0b8054cbaec495dfc438f47745b3faeea8d21990 Mon Sep 17 00:00:00 2001 From: Matthew Barksdale Date: Thu, 20 Jan 2011 02:22:58 -0500 Subject: [PATCH] Added API::IRC::quit --- doc/CHANGELOG | 2 +- src/API/IRC.pm | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index ce7d9a6..6413ae5 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,7 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev ================================================================== - * Added mode, privmsg, and notice subroutine to API::IRC. + * Added mode, privmsg, notice, and quit subroutine to API::IRC. * Added PASS support. * Bug fix: err() fatal errors now work. They didn't work due to bad regex. diff --git a/src/API/IRC.pm b/src/API/IRC.pm index 8db854a..81f58d9 100644 --- a/src/API/IRC.pm +++ b/src/API/IRC.pm @@ -9,7 +9,7 @@ use warnings; use Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(cjoin cpart mode privmsg notice); +our @EXPORT_OK = qw(cjoin cpart mode privmsg notice quit); # Join a channel. @@ -51,3 +51,16 @@ sub notice { Auto::socksnd($svr, "NOTICE $target :$message"); } + +# Quit IRC +sub quit { + my ($svr, $reason) = @_; + + if (defined $reason) { + Auto::socksnd($svr, "QUIT :$reason"); + } + else { + Auto::socksnd($svr, "QUIT :Leaving"); + } +} +