# ====================================================
# Autor: n.d.p. / 2001-01-07
-# lm : n.d.p. / 2001-01-08
+# lm : n.d.p. / 2001-02-25
# ====================================================
# Funktion:
# * Schnittstellen fuer den Zugriff auf Messages
package Posting::_lib;
-use vars qw(@ISA @EXPORT_OK);
+use vars qw(@EXPORT_OK);
+use base qw(Exporter);
use Encode::Plain; $Encode::Plain::utf8 = 1;
# Funktionsexport
# ====================================================
-require Exporter;
-@ISA = qw(Exporter);
@EXPORT_OK = qw(get_message_header get_message_body get_message_node parse_single_thread
hr_time short_hr_time long_hr_time
get_all_threads
# Messagebody auslesen
###########################
-sub get_message_body ($$) {
- my ($xml,$mid) = @_;
+sub get_message_body ($$)
+{
+ my ($xml, $mid) = @_;
my $body;
- foreach ($xml -> getElementsByTagName ('ContentList', 1) -> item (0) -> getElementsByTagName ('MessageContent', 0)) {
- if ($_ -> getAttribute ('mid') eq $mid) {
+ foreach ($xml -> getElementsByTagName ('ContentList', 1) -> item (0) -> getElementsByTagName ('MessageContent', 0))
+ {
+ if ($_ -> getAttribute ('mid') eq $mid)
+ {
$body = ($_ -> hasChildNodes)?$_ -> getFirstChild -> getData:'';
- last;}}
+ last;
+ }
+ }
\$body;
}
ip => $_ -> getAttribute ('ip'),
kids => [$_ -> getElementsByTagName ('Message', 0)],
answers => $_ -> getElementsByTagName ('Message') -> getLength,
- deleted => ($_ -> getAttribute ('flag') eq 'deleted')?1:0,
+ deleted => $_ -> getAttribute ('invisible'),
+ archive => $_ -> getAttribute ('archive'),
name => plain($header -> {name}),
cat => plain($header -> {category} or ''),
subject => plain($header -> {subject}),
my $message = $xml -> createElement ('Message');
$message -> setAttribute ('id', 'm'.$msg -> {mid});
- $message -> setAttribute ('flag', 'deleted') if ($msg -> {deleted});
+ $message -> setAttribute ('invisible', '1') if ($msg -> {deleted});
+ $message -> setAttribute ('archive', '1') if ($msg -> {archive});
# Header erzeugen
- my $header = $xml -> createElement ('Header');
+ my $header = $xml -> createElement ('Header');
# alles inside of 'Header'
my $author = $xml -> createElement ('Author');
- my $name = $xml -> createElement ('Name');
- $name -> addText (toUTF8($msg -> {name}));
- my $email = $xml -> createElement ('Email');
+ my $name = $xml -> createElement ('Name');
+ $name -> addText (toUTF8($msg -> {name}));
+
+ my $email = $xml -> createElement ('Email');
my $category = $xml -> createElement ('Category');
$category -> addText (toUTF8($msg -> {cat}));
my $date = $xml -> createElement ('Date');
$date -> setAttribute ('longSec', $msg -> {time});
- $author -> appendChild ($name);
- $author -> appendChild ($email);
+ $author -> appendChild ($name);
+ $author -> appendChild ($email);
$header -> appendChild ($author);
$header -> appendChild ($category);
$header -> appendChild ($subject);
if ($msg -> {kids}) {
for (@{$msg -> {kids}}) {
- $message -> appendChild (&create_message_xml ($xml, $msges, $_));}}
+ $message -> appendChild (&create_message_xml ($xml, $msges, $_));
+ }
+ }
$message;
}
($last_message) = map {/(\d+)/} $xml =~ /<Forum.+?lastMessage="([^"]+)"[^>]*>/;}
my $reg_msg = qr~(?:</Message>
- |<Message\s+id="m(\d+)"\s+unid="([^"]*)"(?:\s+flag="([^"]*)")?[^>]*>\s*
+ |<Message\s+id="m(\d+)"\s+unid="([^"]*)"(?:\s+invisible="([^"]*)")?(?:\s+archive="([^"]*)")?[^>]*>\s*
<Header>[^<]*(?:<(?!Name>)[^<]*)*
<Name>([^<]+)</Name>[^<]*(?:<(?!Category>)[^<]*)*
<Category>([^<]*)</Category>\s*
while ($thread =~ m;$reg_msg;g) {
- if (defined($9)) {
+ if (defined($10)) {
push @stack,$cmno if (defined $cmno);
push @msg, {};
$msg[-1] -> {name},
$msg[-1] -> {cat},
$msg[-1] -> {subject},
- $msg[-1] -> {time}) = ($1, $2, $4, $5, $6, $7);
+ $msg[-1] -> {time}) = ($1, $2, $5, $6, $7, $8);
- $msg[-1] -> {deleted} = ($3 eq 'deleted')?1:undef;
+ $msg[-1] -> {deleted} = $3;
+ $msg[-1] -> {archive} = $4;
$msg[-1] -> {name} =~ s/&/&/g;
$msg[-1] -> {cat} =~ s/&/&/g;
$msg[-1] -> {answers} = 0;
$msg[-1] -> {level} = $level++;}
- elsif (defined ($8)) {
+ elsif (defined ($9)) {
push @msg, {};
if (defined $cmno) {
$msg[-1] -> {name},
$msg[-1] -> {cat},
$msg[-1] -> {subject},
- $msg[-1] -> {time}) = ($1, $2, $4, $5, $6, $7);
+ $msg[-1] -> {time}) = ($1, $2, $5, $6, $7, $8);
- $msg[-1] -> {deleted} = ($3 eq 'deleted')?1:undef;
+ $msg[-1] -> {deleted} = $3;
+ $msg[-1] -> {archive} = $4;
$msg[-1] -> {name} =~ s/&/&/g;
$msg[-1] -> {cat} =~ s/&/&/g;
$level = $msg -> {level};
$xml .= '<Message id="m'.$msg -> {mid}.'"'
.' unid="'.$msg -> {unid}.'"'
- .(($msg -> {deleted})?' flag="deleted"':'')
+ .(($msg -> {deleted})?' invisible="1"':'')
+ .(($msg -> {archive})?' archive="1"':'')
.'>'
.'<Header>'
.'<Author>'
###########################
sub hr_time ($) {
- my @month = qw(Januar Februar M\303\244rz April Mail Juni Juli August September Oktober November Dezember);
- # ^^^^^^^^ - UTF8 #
+ my @month = (qw(Januar Februar), "M\303\244rz", qw(April Mail Juni Juli August September Oktober November Dezember));
+ # ^^^^^^^^ - UTF8 #
my (undef, $min, $hour, $day, $mon, $year) = localtime ($_[0]);
}
sub long_hr_time ($) {
- my @month = qw(Januar Februar M\303\244rz April Mail Juni Juli August September Oktober November Dezember);
- # ^^^^^^^^ - UTF8 #
+ my @month = (qw(Januar Februar), "M\303\244rz", qw(April Mail Juni Juli August September Oktober November Dezember));
+ # ^^^^^^^^ - UTF8 #
my @wday = qw(Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag);
my ($sek, $min, $hour, $day, $mon, $year, $wday) = localtime ($_[0]);