Index: /branches/stable/cgi-bin/IPDB.pm
===================================================================
--- /branches/stable/cgi-bin/IPDB.pm	(revision 70)
+++ /branches/stable/cgi-bin/IPDB.pm	(revision 71)
@@ -1,4 +1,4 @@
 # ipdb/cgi-bin/IPDB.pm
-# Contains DB-related functions for IPDB
+# Contains functions for IPDB - database access, subnet mangling, block allocation, etc
 ###
 # SVN revision info
@@ -7,6 +7,5 @@
 # Last update by $Author$
 ###
-
-# Split from CommonWeb.pm 08/13/2004 kdeugau@vianet
+# Copyright (C) 2004 - Kris Deugau
 
 package IPDB;
@@ -15,13 +14,16 @@
 use warnings;
 use Exporter;
+use Net::SMTP;
+use POSIX;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 $VERSION	= 1.0;
 @ISA		= qw(Exporter);
-@EXPORT_OK	= qw(&connectDB &checkDBSanity);
+@EXPORT_OK	= qw(&connectDB &checkDBSanity &allocateBlock &mailNotify);
 
 @EXPORT		= (); # Export nothing by default.
-%EXPORT_TAGS	= ( ALL => [qw( &connectDB &checkDBSanity )]
+%EXPORT_TAGS	= ( ALL => [qw( &connectDB &checkDBSanity &allocateBlock &mailNotify)]
 		  );
+
 
 # Creates connection to IPDB.
@@ -66,4 +68,28 @@
 } # end checkDBSanity
 
+
+# allocateBlock()
+# Does all of the magic of actually allocating a netblock
+sub allocateBlock($) {
+}
+
+
+# mailNotify()
+# Sends notification mail to recipients regarding an IPDB operation
+sub mailNotify ($$$) {
+  my ($recip,$subj,$message) = @_;
+  my $mailer = Net::SMTP->new("smtp.example.com", Hello => "ipdb.example.com");
+
+  $mailer->mail('ipdb@example.com');
+  $mailer->to($recip);
+  $mailer->data("From: \"IP Database\" <ipdb\@example.com>\n",
+	"Date: ".strftime("%a, %d %b %Y %H:%M:%S %z",localtime)."\n",
+	"Subject: {IPDB} $subj\n",
+	"X-Mailer: IPDB Notify v".sprintf("%.1d",$IPDB::VERSION)."\n",
+	"Organization: Example Corp\n",
+	"\n$message\n");
+  $mailer->quit;
+}
+
 # Indicates module loaded OK.  Required by Perl.
 1;
Index: /branches/stable/cgi-bin/main.cgi
===================================================================
--- /branches/stable/cgi-bin/main.cgi	(revision 70)
+++ /branches/stable/cgi-bin/main.cgi	(revision 71)
@@ -47,6 +47,6 @@
 
 my %full_alloc_types = (
-	"ci","Cable pool IP",
-	"di","DSL pool IP",
+	"ci","Static cable IP",
+	"di","Static DSL IP",
 	"si","Server pool IP",
 	"mi","Static dialup IP",
@@ -987,4 +987,7 @@
     print qq(<div class="center"><div class="heading">The IP $cidr has been allocated to customer $webvar{custid}</div></div>);
     syslog "notice", "$authuser allocated $cidr to $webvar{custid}";
+# Notify tech@example.com
+    mailNotify('tech@example.com','$full_alloc_types{$webvar{alloctype}} allocation',
+	"$full_alloc_types{$webvar{alloctype}} $cidr allocated to customer $webvar{custid}");
 
   } else { # end IP-from-pool allocation
