'foo' => { 'item' => { 'nick' => 'Hans', ... }, }
instead of
foo' => { 'item' => {
'nick' => 'Hans',
...
},
}
[2003-10-30 09:15 CST] Darren (email) Unfortunatly this doesnt always work. If a user "un-registers" from JUD, then their entry appears in the global.xdb as follows:
Normal Entry:
Test Name Test Name Test test.daz@foobar.com
Entry when unregistered:
Looks like a bug in Jabber but it does happen... The script falls over when it fails to find the element.
[2003-10-30 09:16 CST] Darren (email) Looks like this page gets upset when you submit XML type data as a comment... Sorry!
#!/usr/bin/perl
##################################################
#
# Name: Online Jabber User Directory
#
# Desc: Creates a HTML page with a list of the
# Jabber server's users.
#
# Revision: 1.0
#
# Date: 04/29/2003
#
# Written by: Doug Gruber
#
# Notes: I write code for a living not literature,
# so any words spelled wrong in any comments
# or anything, whoops ;)
#
##################################################
use strict;
use CGI qw(:standard);
use XML::Simple;
my $ref = XMLin("/path/to/jabber/spool/jud/global.xdb");
my $itemref = $ref->{'foo'}->{'item'};
my $style=<<END;
<!--
A {
COLOR: #ffffff
}
BODY {
FONT-SIZE: 12px;
COLOR: #ffffff;
FONT-FAMILY: Arial, Geneva, Helvetica;
BACKGROUND-COLOR: #000000;
TEXT-ALIGN: left;
TEXT-DECORATION: none;
}
TD {
FONT-SIZE: 12px;
COLOR: #ffffff;
FONT-FAMILY: Arial, Geneva, Helvetica;
TEXT-ALIGN: left;
TEXT-DECORATION: none;
}
-->
END
print header();
print start_html(-title=>"Online Jabber User Directory v1.0", -style=>{-code=>$style});
print "\n\n";
print " <table width=\"100%\">\n";
print " <tr>\n";
print " <td>\n";
print " <br>\n";
foreach my $name (sort keys %{ $itemref }) {
my $user = $itemref->{$name};
my $email = $user->{'email'};
my $nick = $user->{'nick'};
my $jid = $user->{'jid'};
print " <table width=\"100%\" border=\"1\">\n";
print " <tr>\n";
print " <td width=\"10%\">Name: </td><td>$name</td>\n";
print " </tr>\n";
print " <tr>\n";
print " <td>Jabber ID: </td><td>$jid</td>\n";
print " </tr>\n";
print " <tr>\n";
print " <td>Nickname: </td><td>$nick</td>\n";
print " </tr>\n";
print " </table>\n";
print " <br>\n";
}
print " </td>\n";
print " </tr>\n";
print " </table>\n";
print "\n";
print end_html();