sub getxmpp { my $mech = WWW::Mechanize->new( cookie_jar => {} ); $mech->agent_alias( 'Windows IE 6' ); $mech->add_header('Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8' ); $mech->add_header('X-Requested-With' => 'XMLHttpRequest' ); my ( $self, $event ) = @_; my $nick = shift; my $loginpost = $mech->post( 'http://www.quakelive.com/user/login', { u => 'user@mail.com', p => 'passwort', r => '0', } ); $mech->get("http://www.quakelive.com/user/load"); my $site = $mech->content(); if($site =~/USERNAME":"(.+)","XAID":"(.+)","STATUS/){ push(@xmppdata,("$1","$2")); } else { print "Fail!\n$site"; exit; } } sub xmppconnect { use constant USER => $xmppdata[0]; use constant PASS => $xmppdata[1]; my $connection = Net::XMPP::Client->new(); $connection->Connect( hostname => 'xmpp.quakelive.com') or die "Cannot connect ($!)\n"; my @result = $connection->AuthSend( "username" => USER, "password" => PASS, "ressource" => 'quakelive'); if (!defined($result[0])) { print "Authed with XMPP server as user $xmppdata[0] with password $xmppdata[1]\n"; } else { die "Ident/Auth with server failed: $result[0] - $result[1]\n"; } $connection->PresenceSend(); my $message = Net::XMPP::Message->new(); $message->SetMessage( "to" => 'Mindfoo\@xmpp.quakelive.com', "type" => "chat", "body" => "testmsg from script"); $connection->Send($message) or die "Cant send msg!\n"; sleep(1); $connection->Disconnect(); }