From 7f475ba815a15083e9eab771814926d600d45841 Mon Sep 17 00:00:00 2001 From: rk Date: Tue, 28 Aug 2001 18:45:40 +0000 Subject: [PATCH] no message --- dbscripts/mail.config | 21 -------- dbscripts/mail2table.pl | 50 ------------------- dbscripts/make_smsticker | 1 - dbscripts/smsreceiver.config | 16 ------- dbscripts/smsreceiver.pl | 85 -------------------------------- dbscripts/table2html.pl | 93 ----------------------------------- dbscripts/table2mail.pl | 112 ------------------------------------------- 7 files changed, 378 deletions(-) delete mode 100755 dbscripts/mail.config delete mode 100755 dbscripts/mail2table.pl delete mode 100755 dbscripts/make_smsticker delete mode 100755 dbscripts/smsreceiver.config delete mode 100755 dbscripts/smsreceiver.pl delete mode 100755 dbscripts/table2html.pl delete mode 100755 dbscripts/table2mail.pl diff --git a/dbscripts/mail.config b/dbscripts/mail.config deleted file mode 100755 index 79e41355..00000000 --- a/dbscripts/mail.config +++ /dev/null @@ -1,21 +0,0 @@ -# -# MailerScript Konfigurationsdatei -# - -[public] -logfile=/tmp/mailer.log -sendmail=/usr/lib/sendmail -t -# sendmail=cat - -[db] -dsn=DBI:mysql:database=nadiraktuell;host=search.nadir.org -user=aktuell -passwd=aktuell - -[mail] -table=content_objekt - -to=nadir-aktuell-abo@nadir.org -from=aktuell@nadir.org -reply-to=aktuell@nadir.org - diff --git a/dbscripts/mail2table.pl b/dbscripts/mail2table.pl deleted file mode 100755 index 41da1655..00000000 --- a/dbscripts/mail2table.pl +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/perl - -use DBI; -use POSIX qw(strftime); - -$db_user="bla"; -$db_password="bla"; -$dbi_string="DBI:mysql:hostname=192.168.4.8;database=indy"; - -die unless ($dbh=DBI->connect($dbi_string,$db_user,$db_password)); - - -### prepare -$mo_insert_q="insert into content_objekt (titel, urheber, freigeschaltet, datum, ishtml, storage_path, thema_id, contentdata, created, lastchange, mail_sent) values (?,?,0,?,0,?,0,?,NOW(),NOW(),0)"; -$mo_insert_sth=$dbh->prepare($mo_insert_q); - -# setze datum - -$datum = &POSIX::strftime( '%Y%m%d', localtime time ); -$storage_path=&POSIX::strftime( '%Y/%m/%d', localtime time ); - - -$headermode=1; -$titel="";$from="";$contentdata=""; -while (<>) { - if($headermode==1) { - if (/^Subject: (.*)/) { - $titel=$1; - if (/^Subject: (.*)/) { - $titel=$1; - } - } - if (/^From: (.*)/) { - $from = $1; - } - if (/^$/) { - print "Switched to Body\n"; - $headermode=0; - } - } - else { - $contentdata = $contentdata . $_; - } -} - print "$datum $storage_path $from $titel \n"; - $mo_insert_sth->execute($titel, $from, $datum, $storage_path, $contentdata); - - -1; - diff --git a/dbscripts/make_smsticker b/dbscripts/make_smsticker deleted file mode 100755 index e9cb6b1e..00000000 --- a/dbscripts/make_smsticker +++ /dev/null @@ -1 +0,0 @@ -/usr/local/java/jdk/bin/java -classpath /www/nadiraktuell/source:/usr/local/java/freemarker:/usr/local/java/mm.mysql/mysql_uncomp.jar:/usr/local/java/jsdk/lib/jsdk.jar nadir.aktuell.producer.ProducerSMS diff --git a/dbscripts/smsreceiver.config b/dbscripts/smsreceiver.config deleted file mode 100755 index 9ea63762..00000000 --- a/dbscripts/smsreceiver.config +++ /dev/null @@ -1,16 +0,0 @@ -# -# MailerScript Konfigurationsdatei -# - -[public] -logfile=/tmp/mailer.log - -[db] -# dsn=DBI:mysql:database=campticker;host=krabat.nadir.org -dsn=DBI:mysql:database=nadiraktuell;host=192.168.4.8 -user=aktuell -passwd=aktuell - -[mail] -table=messsages - diff --git a/dbscripts/smsreceiver.pl b/dbscripts/smsreceiver.pl deleted file mode 100755 index 693e21c2..00000000 --- a/dbscripts/smsreceiver.pl +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/perl - -use DBI; - -$0=~m#[^/]+$#; -$cmdpath=$`; -if ($cmdpath eq "") { $cmdpath="./"; } - -unshift(@INC,$cmdpath."lib"); -require "property.pl"; -require "log.pl"; - -### configure here - -$config_file=$cmdpath."smsreceiver.config"; - -### no configuration beyond this line - -$props=&Property::read($config_file); - -### connect logfile - -tie *LOGFILE, 'Logfile', $$props{'public'}{'logfile'}, 'SMSRECEIVER'; - -print LOGFILE "Connecting to ".$$props{'db'}{'dsn'}." as user ".$$props{'db'}{'user'}."\n"; - - -### connect to db -$dbh=DBI->connect($$props{'db'}{'dsn'},$$props{'db'}{'user'},$$props{'db'}{'passwd'}); -if (!defined $dbh) { - print LOGFILE "Error while connecting DB\n"; - exit(0); - } -$table=$$props{'mail'}{'table'}; - -### prepare -$mo_insert_q="insert into $table (produced,type_sms,message,created) values (?,?,?,NOW())"; -$mo_insert_sth=$dbh->prepare($mo_insert_q); - -$headermode=1; -while (<>) { - if($headermode==1) { - if (/^Subject: (.*)/i) { - $subject=$1; - } - if (/^From: (.*)/i) { - $from = $1; - } - if (/^Content-type:\s+(.*)/i) { - $content_type=$1; - } - if (/^$/) { - $headermode=0; - } - } - else { - push(@contentdata,$_); - } -} - -### filter out mime-crap - -if ((defined $content_type)&&($content_type!~m#^text/plain#i)) { - print LOGFILE "Got mime-mail: $from ($subject) ".localtime(time)."\n"; - print LOGFILE "Content: ".join('',@contentdata)."\n"; - exit(); - } - -### try to identify sms - -if ($from=~/^\+?\d+\@/) { - ### coming from an emailaccount with a telefon number as user-part in From: - - ### sms is in first line of body - $text=shift(@contentdata); - - $type=1; - } -else { - $text=join('',@contentdata); - $type=2; - } - -print LOGFILE "$type: $text\n"; -$mo_insert_sth->execute(0,$type,$text); diff --git a/dbscripts/table2html.pl b/dbscripts/table2html.pl deleted file mode 100755 index 023db726..00000000 --- a/dbscripts/table2html.pl +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/perl - -### extract - -use DBI; - -$db_user="root"; -$dbi_string="DBI:mysql:nadiraktuell"; - -die "parameter [-form] tableName" if ($#ARGV>1 | $#ARGV==-1); -die unless ($dbh=DBI->connect($dbi_string,$db_user)); - -$form=0; - -if ($#ARGV == 1){ - $form=1; - $tableName=$ARGV[1]; -} -else { - $tableName=$ARGV[0]; -} - -$sth=$dbh->prepare(<execute; - -if (defined $sth) { - - print(< - - -nadiraktuell.$tableName - - - - -nadiraktuell.$tableName

-HEAD - - - if ($form==1) { - print "

-\t - - - - - - - -\n"; - } -# -# Schleife - - while (@data=$sth->fetchrow_array) { - - print "\n\n\n"; - if ($form==1) { - print "\n"; - } - else { - print "\n"; - } - print "\n\n"; - - } - - if ($form==1) { - print " - -
$data[0]:<\$\{$data[0]\}>
- - - - - -
"; - } - -print(< - -BODY -} - -$sth->finish; -$dbh->disconnect; - diff --git a/dbscripts/table2mail.pl b/dbscripts/table2mail.pl deleted file mode 100755 index c23834ab..00000000 --- a/dbscripts/table2mail.pl +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/perl - -use DBI; - -$0=~m#[^/]+$#; -$cmdpath=$`; -if ($cmdpath eq "") { $cmdpath="./"; } - -unshift(@INC,$cmdpath."lib"); -require "property.pl"; -require "log.pl"; -require "convert.pl"; - -### configure here - -$config_file=$cmdpath."mail.config"; -# print $config_file,"\n"; - -### no configuration beyond this line - -$props=&Property::read($config_file); - -### connect logfile - -tie *LOGFILE, 'Logfile', $$props{'public'}{'logfile'}, 'MAIL'; -print LOGFILE "starting: ".localtime(time)."\n"; - -# print $$props{'db'}{'dsn'},$$props{'db'}{'user'},$$props{'db'}{'passwd'},"\n"; - - -### connect to db -$dbh=DBI->connect($$props{'db'}{'dsn'},$$props{'db'}{'user'},$$props{'db'}{'passwd'}); -if ($dbh->errstr ne "") { - print LOGFILE "Error while connecting DB - ".$dbh->error."\n"; - exit(0); - } - -### prepare some statements - -$select_unsend=$dbh->prepare("select id,ort,titel,urheber,urheber_id,date_format(datum,'%d.%m.%Y') as pdatum,contentdata,abstract,islink,ishtml,link_url from ".$$props{'mail'}{'table'}." where mail_sent=0 and freigeschaltet=1 and adddate(lastchange,interval 30 MINUTE) < current_timestamp()"); -$select_urheber=$dbh->prepare("select name,email,homepage from gruppen where id=?"); -$update_unsend=$dbh->prepare("update ".$$props{'mail'}{'table'}." set mail_sent=1 where id=?"); - -$select_unsend->execute; -while ($hash=$select_unsend->fetchrow_hashref) { - if (open(MAILER,"|".$$props{'public'}{'sendmail'})) { - print MAILER "To: ".$$props{'mail'}{'to'}."\n"; - print MAILER "From: ".$$props{'mail'}{'from'}."\n"; - print MAILER "Reply-To: ".$$props{'mail'}{'reply-to'}."\n"; - print MAILER "Subject: ".$$hash{'ort'}.": ".$$hash{'titel'}."\n"; - - print MAILER "\n"; # end of header - - print MAILER $$hash{'titel'}."\n"; - - $urheber=""; - $u_email=""; - $u_homepage=""; - if ($$hash{'urheber'} eq "") { - if ($$hash{'urheber_id'} != 0) { - $select_urheber->execute($$hash{'urheber_id'}); - if ($line=$select_urheber->fetchrow_hashref()) { - $urheber=$$line{'name'}; - $u_email=$$line{'email'}; - $u_hompage=$$line{'homepage'}; - } - } - } - else { - $urheber=$$hash{'urheber'}; - } - - if ($urheber ne "") { print MAILER "Von : ".$urheber."\n"; } - if ($u_email ne "") { print MAILER "Email: ".$u_email."\n"; } - if ($u_homepage ne "") { print MAILER "Page : ".$u_homepage."\n"; } - - print MAILER "Ort : ".$$hash{'ort'}."\n"; - print MAILER "Datum: ".$$hash{'pdatum'}."\n"; - if ($$hash{'islink'} == 1) { - print MAILER "\n\n".$$hash{'abstract'}."\n"; - } - else { - if ($$hash{'ishtml'}>0) { - print MAILER "\n\n".&html_to_text($props,$$hash{'contentdata'})."\n"; - } - else { - print MAILER "\n\n".$$hash{'contentdata'}."\n"; - } - } - - if ($$hash{'link_url'} ne "") { - print MAILER "Weiteres: "; - if (substr($$hash{'link_url'},0,1) eq "/") { - print MAILER "http://www.nadir.org"; - } - print MAILER $$hash{'link_url'}."\n"; - } - ### footer - print MAILER "\n*** $LIST -- Aboliste mit Nachrichten von http://www.nadir.org\n"; - print MAILER "*** Beitraege: nadir-aktuell\@nadir.org / Redaktion: nadir-aktuell-red\@nadir.org\n"; - print MAILER "*** Unsubscribe: majordomo\@nadir.org mit unsubscribe $LIST im body\n"; - - close(MAILER); - - $update_unsend->execute($$hash{'id'}); - print LOGFILE "[".$$hash{'id'}."] send\n" - } - else { - print LOGFILE "Error cannot open ".$$props{'public'}{'sendmail'}." - $!\n"; - } - } - -- 2.11.0