File: AddBccSearch

package info (click to toggle)
pronto 2.4.0-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,112 kB
  • ctags: 488
  • sloc: perl: 22,159; makefile: 140; sh: 34; sql: 7
file content (35 lines) | stat: -rwxr-xr-x 1,235 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl -w
BEGIN {
	$libpath = $0;
	$libpath =~ s!/[^/]+$!!;
	$libpath =~ s!/bin$!/lib/pronto!;
	if (! -e $libpath) { die "Can't find required files in $libpath"; };
}

use lib "$libpath";
use lib "$libpath/modules/lib/perl5/site_perl/5.005";
use DBI;

require 'prontolib.pl';
&read_prefs;

my $dbh=&open_db_conn;
if ($prefs{'DatabaseDriver'} eq "Pg") {
$sth1 = $dbh->prepare("alter table messages add column bcc text");
} elsif ($prefs{'DatabaseDriver'} eq "mysql") {
$sth1 = $dbh->prepare("alter table messages add bcc text");
} elsif ($prefs{'DatabaseDriver'} eq "CSV") { print("CSV driver\n"); }
if ($prefs{'DatabaseDriver'} eq "Pg" or $prefs{'DatabaseDriver'} eq "mysql") {
$sth1->execute;
}
$sth1 = $dbh->prepare("insert into boxlist (id, name, sibling, parent)
values (100,'Search', 65535, 0)");
$sth1->execute;
if ($prefs{'DatabaseDriver'} eq "CSV") {
print("I didn't create the bcc field in your messages table due to the fact
that CSV doesn't support the alter table statement, you will have to do it by hand
add a field to your messages table called bcc and insert , manually for each message
or export all your mail - delete it and all you have to do is add the bcc field
and reimport your mail after that...
");
}