Ich war mal so frei und hab' nen Diff der beiden Subroutinen erstellt, damit es etwas klarer wird, was Du geändert hast.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff -u ?.1
--- a.1 2009-04-04 20:45:21.415888190 +0200
+++ b.1 2009-04-04 20:46:01.200703520 +0200
@@ -9,16 +9,17 @@
my $loginpost = $mech->post(
'http://www.quakelive.com/user/login',
{
- u => 'email@domain.com',
- p => 'meinpass',
+ u => 'user@mail.com',
+ p => 'passwort',
r => '0',
}
);
$mech->get("http://www.quakelive.com/user/load");
my $site = $mech->content();
- if($site =~/".+XAID":"(.+)","STATUS/){
- return $1;
+ if($site =~/USERNAME":"(.+)","XAID":"(.+)","STATUS/){
+ push(@xmppdata,("$1","$2"));
} else {
- print "fail";
+ print "Fail!\n$site";
+ exit;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff -u ?.2
--- a.2 2009-04-04 20:45:33.828027839 +0200
+++ b.2 2009-04-04 20:47:03.097072730 +0200
@@ -1,21 +1,22 @@
sub xmppconnect {
+ use constant USER => $xmppdata[0];
+ use constant PASS => $xmppdata[1];
my $connection = Net::XMPP::Client->new();
- my $xmpp = getxmpp();
$connection->Connect( hostname => 'xmpp.quakelive.com') or die "Cannot connect ($!)\n";
- my @result = $connection->AuthSend( "username" => 'qlstats', "password" => $xmpp, "resource" => 'quakelive');
- if ($result[0] ne "ok") {
+ 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();
-
+ $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(2);
+ sleep(1);
$connection->Disconnect();
}
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!