Mercurial > eagle-eye
changeset 9:ae412d1f7761
added logout function.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 08 Oct 2008 04:30:32 +0800 |
parents | e4b3168d0319 |
children | f590b5ea5e55 |
files | Ikariam.pm scores.pl |
diffstat | 2 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Ikariam.pm Wed Oct 08 04:23:01 2008 +0800 +++ b/Ikariam.pm Wed Oct 08 04:30:32 2008 +0800 @@ -209,11 +209,16 @@ return @cities; } +sub logout +{ + my $self = shift; + $self->{mech}->get(sprintf('http://%s/index.php?action=loginAvatar&function=logout', $self->{server})); +} + sub login { my $self = shift; - # $self->{mech}->get(sprintf('http://%s/', $self->{server})); my $res = $self->{mech}->post(sprintf("http://%s/index.php?action=loginAvatar&function=login", $self->{server}), [ name => $self->{user}, password => $self->{pass},
--- a/scores.pl Wed Oct 08 04:23:01 2008 +0800 +++ b/scores.pl Wed Oct 08 04:30:32 2008 +0800 @@ -9,10 +9,8 @@ { my $users = shift; - my $u; foreach my $user (values(%{$users})) { - next if($u == $user->{'id'}); $u = $user->{'id'}; printf("Saving %s\n", $user->{'name'}); if(my $c = Ikariam::User->retrieve($user->{id})) @@ -64,12 +62,11 @@ } } - foreach my $o (keys(%owners)) { - foreach my $x (qw/score army_score_main trader_score_secondary/) + foreach my $type (qw/score army_score_main trader_score_secondary/) { - my $users = $i->viewScore($x, $o, 0); + my $users = $i->viewScore($type, $o, 0); saveUser($users); } }