#!/usr/bin/perl
(most probably)
[2004-03-05 05:24 CST] agathis (email) Here (http://agathis.msk.ru/hortsmanns_jus.txt) is script with added support for any language (powered by iconv :)); paths for FreeBSD-4. Also it will remove temp files.
[2004-05-20 17:01 CDT] chris (email) could someone email me the windows version? Thanks
[2004-05-28 18:05 CDT] Dmitrij (email) I'm looking for the windows version too.
[2004-07-30 21:36 CDT] Eric (email) Hi hi,
I'm working in a company and running exodus as our instant messaging tool.
Is there anyway we can bulk create users?
What kind of info do i need to replace if i want to run this script?
Thanks alot!
#!/usr/bin/perl
#jus.pl (jabber user setup) version #0.0.2
#Originally based on a script by Joe Horstmann
#date modified: 2003-11-11 by "Giannis Stoilis" <giannis@stoilis.gr>
#I created this script to help create and manage user account setup and roster lists for a corp. intranet server.
#All you have to do is set the initial password for all users and host variables. Then create a userlist.txt file.
#The userlist.txt file should contain the username of each user on a single line.
#Run the jus.pl script in the same dir as the userlist.txt file and the script will create xml files.
#The user xml files will contain a roster with everyone added to everyone's roster.
## stoilis: Added some commands to support Greek rosters, full names, and groups. You need iconv.
#Sets the default password for all users
$password = "password";
#Sets the default jabber server hostname or IP address for all users
$host = "jabber.server.com";
$group = "IT Department";
#Sets the spool path, containing user xml files
$spool_path = "/usr/local/jabber-1.4.2/spool/jabber.server.com";
#Where to read the list from
## ATTENCTION: Format of this file is:
# <username> <real name> <group>
## No comments or empty lines allowed. Be sure to seperate every field with 2 spaces
$list_file = "/usr/local/jabber-1.4.2/userlist.txt";
##########
#main routine
&read_list;
&create_roster;
&read_roster;
&create_xml;
exit;
##########
sub read_list {
open INPUT, $list_file;
chomp (@userlist = <INPUT>);
close INPUT;
}
##########
sub create_roster {
open XML,">$spool_path/roster.xml" or die "Cannot open roster.xml for write :$!";
print XML "<query xmlns='jabber:iq:roster' xdbns='jabber:iq:roster'>";
foreach $username (@userlist) {
@user_data = split(/ /,$username);
print XML "<item jid='$user_data[0]\@$host' name='$user_data[1]' subscription='both'><group>$user_data[2]</group></item>";
}
print XML "</query>";
close XML;
}
##########
sub read_roster {
open INPUT, "$spool_path/roster.xml";
chomp ($roster = <INPUT>);
close INPUT;
}
##########
sub create_xml {
foreach $username (@userlist) {
@user_data = split(/ /,$username);
open XML,">$spool_path/tmp.xml" or die "Cannot open $spool_path/$user_data[0].xml for write :$!";
print XML "<xdb><password xmlns='jabber:iq:auth' xdbns='jabber:iq:auth'>$password</password><query xmlns='jabber:iq:register' xdbns='jabber:iq:register'><username>$user_data[0]</username><password xmlns='jabber:iq:auth'>$password</password></query>$roster</xdb>";
close XML;
system "/usr/bin/iconv --from-code=ISO8859-7 --to-code=UNICODE $spool_path/tmp.xml -o $spool_path/$user_data[0].xml";
# unlink "$spool_path/tmp.xml";
}
}