-sub modify_posting($$$)
-{
- my ($forum, $tpath, $info) = @_;
- my ($tid, $mid, $indexFile, $data) = ($info->{'thread'},
- $info->{'posting'},
- $info->{'indexFile'},
- $info->{'data'});
- my ($subject, $category, $body) = ($data->{'subject'}, $data->{'category'}, $data->{'body'});
-
- my %msgdata;
-
- # These values may be changed by change_posting_value()
- $subject && $msgdata{'Subject'} = $subject;
- $category && $msgdata{'Category'} = $category;
-
- # Thread
- my $tfile = $tpath . '/t' . $tid . '.xml';
- change_posting_value($tfile, 't'.$tid, 'm'.$mid, \$msgdata);
- $body && change_posting_body($tfile, 't'.$tid, 'm'.$mid, $body);
-
- # Forum (does not contain msg bodies)
- if ($subject or $category)
- {
- my ($f, $lthread, $lmsg, $dtd, $zlev) = get_all_threads($forum, 1, 0);
-
- for (@{$f->{$tid}})
- {
- if ($_->{'mid'} == $mid)
- {
- $subject && $_->{'subject'} = $subject;
- $category && $_->{'cat'} = $category;
- }
- }
-
- my %cfxs = (
- 'dtd' => $dtd,
- 'lastMessage' => $lmsg,
- 'lastThread' => $lthread
- );
- my $xmlstring = create_forum_xml_string($f, \%cfxs);
- save_file($forum, $$xmlstring);
+# Todo:
+# * Lock files!
+# * save return values
+#
+sub modify_posting($$$) {
+ my ($forum, $tpath, $info) = @_;
+ my ($tid, $mid, $indexFile, $data) = (
+ $info->{'thread'},
+ $info->{'posting'},
+ $info->{'indexFile'},
+ $info->{'data'}
+ );
+
+ my ($subject, $category, $body) = (
+ $data->{'subject'},
+ $data->{'category'},
+ $data->{'body'}
+ );
+
+ my %msgdata;
+
+ # These values may be changed by change_posting_value()
+ $msgdata{'Subject'} = $subject if $subject;
+ $msgdata{'Category'} = $category if $category;
+
+ # Thread
+ my $tfile = $tpath . '/t' . $tid . '.xml';
+ change_posting_value($tfile, 't'.$tid, 'm'.$mid, \%msgdata);
+ change_posting_body($tfile, 't'.$tid, 'm'.$mid, $body) if $body;
+
+ # Forum (does not contain msg bodies)
+ if ($subject or $category) {
+ my ($f, $lthread, $lmsg, $dtd, $zlev) = get_all_threads($forum, 1, 0);
+
+ for (@{$f->{$tid}}) {
+ if ($_->{'mid'} == $mid) {
+ $_->{'subject'} = $subject if $subject;
+ $_->{'cat'} = $category if $category;
+ }
+ }
+
+ save_file($forum, create_forum_xml_string($f,{dtd=>$dtd,lastMessage=>$lmsg,lastThread$lthread}));
+ }
+