1 |
package Torus::Core; |
2 |
|
3 |
require Exporter; |
4 |
our @ISA = qw(Exporter); |
5 |
our @EXPORT = qw( ); |
6 |
|
7 |
use strict; |
8 |
use warnings; |
9 |
|
10 |
use loadConfig; |
11 |
use Torus::Driver::ldap; |
12 |
|
13 |
my $DEBUGLEVEL = $config->get("debug_level"); |
14 |
my $TRACELEVEL = $config->get("trace_level"); |
15 |
my $bool_started; |
16 |
|
17 |
|
18 |
sub addItem { |
19 |
|
20 |
my $torusObjectType = shift; |
21 |
my $mapiEntry = shift; |
22 |
my $basedn = shift; |
23 |
my $ldapEntry; |
24 |
|
25 |
if (!$bool_started) { |
26 |
Torus::Driver::ldap::connectStore(); |
27 |
} |
28 |
|
29 |
$bool_started = 1; |
30 |
|
31 |
if ($DEBUGLEVEL > 3) { |
32 |
print STDOUT "=" x 3, " ", __PACKAGE__, " ", "=" x 30, "\n"; |
33 |
print STDOUT "recieved torus-object (type=$torusObjectType)", "\n"; |
34 |
print STDOUT "trying to write to (basedn='$basedn')", "\n"; |
35 |
} |
36 |
|
37 |
if ($torusObjectType eq 'MapiContact') { |
38 |
$basedn = Torus::Driver::ldap::createOuSafe($basedn); |
39 |
my $entry = Torus::Driver::ldap::prepareEntry($basedn, $mapiEntry); |
40 |
if (my $result = Torus::Driver::ldap::addEntry($entry)) { |
41 |
#my $error = 0; |
42 |
#$error = 1 if $result->code >= 0; |
43 |
#Torus::Driver::ldap::traceEntry($mapiEntry, $entry, { error => $error, prefix => $result->error }) if $TRACELEVEL >= 2; |
44 |
#undef $result; |
45 |
Torus::Driver::ldap::processResult($entry->{identifier}, $result); |
46 |
} |
47 |
} |
48 |
|
49 |
} |
50 |
|
51 |
1; |