# LiMuBai Bot Utils
# Written by Ben Reser < ben@reser.org>

package LiMuBai::Utils;

use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

require Exporter;
@ISA = qw(Exporter);

@EXPORT = ();
@EXPORT_OK = qw();
%EXPORT_TAGS = (all=>[@EXPORT_OK]);

$VERSION = '0.1';

sub match_hostmask {
  my($host,$hostmask) = @_;

  # Quote anything that isn't alpha numeric
  $hostmask = quotemeta($hostmask);

  # Change the two mask characters to their
  # Perl regex equivalent.
  $hostmask =~ s/\\\*/.*/g;
  $hostmask =~ s/\\\?/.?/g;

  $host =~ /$hostmask/i;
}

sub get_nick {
  my($host) = shift;
  
  $host =~ /^(.*?)\!/;
  return $1;
}

1;
