# $deleted hold deleted (invisible) messages in result (1) oder not (0)
# $sorted direction of message sort: descending (0) (default) or ascending (1)
# Return: scalar context: hash reference
-# list context: list (\%threads, $last_thread, $last_message, \@unids)
+# list context: list (\%threads, $last_thread, $last_message, $dtd, \@unids)
#
sub get_all_threads ($$;$)
{
my ($file, $deleted, $sorted) = @_;
- my ($last_thread, $last_message, @unids, %threads);
+ my ($last_thread, $last_message, $dtd, @unids, %threads);
local (*FILE, $/);
open FILE, $file or return undef;
if (wantarray)
{
+ ($dtd) = $xml =~ /<!DOCTYPE\s+\S+\s+SYSTEM\s+"([^"]+)">/;
($last_thread) = map {/(\d+)/} $xml =~ /<Forum.+?lastThread="([^"]+)"[^>]*>/;
($last_message) = map {/(\d+)/} $xml =~ /<Forum.+?lastMessage="([^"]+)"[^>]*>/;
}
}
wantarray ?
- (\%threads, $last_thread, $last_message, \@unids)
+ (\%threads, $last_thread, $last_message, $dtd, \@unids)
: \%threads;
}