#!/usr/bin/perl # # So this is another result of boredom, which is what drives me to get # into packet radio these days anyway. This is a personal msg inbox # similar to the host mode mboxes that full featured TNC's generally had # # There used to be something called PMS in axutils but it seems to # have died a tragic death, so I slapped this quick perl script # together # # Run this in inetd with a config line something like this. # inbox stream tcp nowait lennylid /home/lennylid/scripts/inbox inbox # # Don't forget to add an /etc/services entry for 'inbox' like this # inbox 2001/tcp # # This allows someone to log in, leave their callsign or email address # and drop you a message. Optionally if you configure for it, it will # use 'mail' and just email you a copy of the message when it is left. # # Just fill in the initial variable options at the top of the script # for your own personal user and node info. # # Once you have all the above options set, make this executable and # you can test it by simply doing 'telnet localhost inbox' before you # add it to say linux node via a command alias to telnet # # The line from my /etc/ax25/node.conf that enables this as an 'app' # in linux node is as follows. # # Alias MBox 'telnet localhost inbox' # # I just put an mbox.hlp file describing it for the users to see but # the prompts within are fairly explanatory. # # I hope this is useful for someone out there, though not many humans # actually exist and use packet radio, let alone on linux these days. # # 73 de Chris KC2RGW 10/30/2011 # # use strict; use warnings; use IO::Handle; use DateTime; # Enter your own callsign and name here for prompt and banners my $sysopcall = "HAMLID-2"; # For the prompt etc. my $nodename = "#LID:HAMLID-2"; # Your real name my $persname = "Leonardo Lid"; # Optional... see near the end, you can have this send you an # email when anyone leaves a message my $emailaddy = "lid6969\@hotmail.com"; # This is the directory path where your message files will be stored my $spooldir = "/home/lennylid/inbox"; # Just some stuff to date stamp the files etc. my $date = DateTime->now->ymd; my $time = DateTime->now->hms; my $timestamp = "$date-$time"; # This is due to read/write via inetd stream autoflush STDOUT; # Does a spool file exist, if not create the directory unless (-e $spooldir ) { mkdir $spooldir or die; } # Print out the banner greeting for anyone logging in print "\n$date $time\n"; my $banner = <\n"; # End of all the welcome banner # Prompt and get the callsign of the caller or their email address print "Your callsign or return email address?: "; chomp (my $callerid = <>); # Strip the ^M's that get inserted with any RETURN sent through inetd $callerid =~ s/ //; # This allows a quit with RETURN, 'b' or 'q', the most common exits if ($callerid eq "" or $callerid eq "b" or $callerid eq "q") { # Say goodbye if they dump out print "73! de $persname $sysopcall\n"; exit; } # Open the filehandle OUTFILE to write the message content to open (OUTFILE,">$spooldir/$callerid-$timestamp.txt"); # Info line inside the message as an info marker print OUTFILE "\nMessage From: $callerid Received: $date at $time\n\n"; # Prompt and get the message text entry print "Welcome: $callerid \n"; print "\nEnter your message for $sysopcall, an \\ex on a line by itself sends the message.\n\n"; # List to store the message content my @msgbody; # Continue to take line based input for the message body until # a \ex is entered on a line by itself to indicate EOF while (<>) { # Is this the last line? if ($_ =~ /^\\ex/) { last; } # If not, shove the line into the list push (@msgbody, $_); } # Dump the list into your output file print OUTFILE @msgbody; # Close the filehandle close (OUTFILE); # Yup, yer done, thank you print "Thank you $callerid, your message has been delivered to $persname, $sysopcall 73!\n\n"; # Do something with the message file you created, in this case use local # system mail to email it to me. You could have a message pop-up dialog # happen or whatever you want. system ("mail -s \"Packet MSG from $callerid\" $emailaddy < $spooldir/$callerid-$timestamp.txt"); exit;