#!/usr/bin/perl ######################################### # message # - deal with message reading/sending ######################################### use localbucky; $dbh = DBI->connect ($dsn); our ($USER, $lastlog) = checkin(); logout() unless ($USER != -1); $input->{username} ||= $input->{object_from_uri} if defined($input->{object_from_uri}); if ($$input{c} eq "s") { my $subject; my $recip = lc($$input{recipient}); my $box; my $out; # send message: take input, check on it, add to db if (!exists($$input{recipient}) || !exists($$input{body})) { error("Missing one or more fields!"); } if ($recip eq "system") { $recip = "marc"; } if (get_uid($recip) == -1) { error("No such user $recip!"); } if (length($input->{subject}) == 0) { # no subject so obviously we have to supply something retarded @subjects = ("sup duder", "WHAUT UP DWIZLINKA", "HAPPY BIG CHAVYO WILVERFAO?", "NO DUM bB SUXCER Ylo TWIENF", "fararyY*F**YFARRRRADAYY+++", "i doINT BELIEVE YOYU!&U#*&!", "fuckN TEHAS D", "YO WHAT UP DOGGIE", "SENdiN BUcKY MeZSaGeZ", "SALWE"); $subject = $subjects[(int rand @subjects)] } else { $subject = $$input{subject}; } my %newmsg = (sender => $USER->{username}, recipient => $recip, unread => 1, subject => $subject, body => $$input{body}); if (exists($input->{later})) { header("saving draft"); menu(); $box = "drafts"; $newmsg{unread} = 0; if (exists($input->{oldid})) { update_message($input->{oldid}, \%newmsg); } else { new_message("$USER->{username}.$box", \%newmsg); } $out = "SAVED AS DRAFT"; } else { header("sending message"); menu(); new_message("$recip.inbox", \%newmsg); $box = "outbox"; $newmsg{unread} = 0; new_message("$USER->{username}.$box", \%newmsg); $out = "MESSAGE SENT"; if (exists($$input{oldid})) { delete_message($$input{oldid}); recount_mailbox("$USER->{username}.drafts"); } } print qq!