From: Dan Boger Date: Tue, 12 Jan 2010 07:40:25 +0000 (-0800) Subject: Improve oauth with multiple accounts X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/commitdiff_plain/e251095e4a33615f0ff99e2f238f9e48814f4950?ds=sidebyside;hp=--cc Improve oauth with multiple accounts --- e251095e4a33615f0ff99e2f238f9e48814f4950 diff --git a/twirssi.pl b/twirssi.pl index c5384cf..3ae46d9 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -600,21 +600,21 @@ sub cmd_oauth { my $store_file = Irssi::settings_get_str("twirssi_oauth_store"); if ($store_file) { - my %store; + my @store; if ( open( OAUTH, $store_file ) ) { while () { chomp; - my ( $k, $v ) = split ' ', 2; - $store{$k} = $v; + next if /$key/i; + push @store, $_; } close OAUTH; } - $store{$key} = "$access_token $access_token_secret"; + push @store, "$key $access_token $access_token_secret"; if ( open( OAUTH, ">$store_file.new" ) ) { - print OAUTH "$_ $store{$_}\n" foreach keys %store; + print OAUTH "$_\n" foreach @store; close OAUTH; rename "$store_file.new", $store_file or ¬ice("Failed to rename $store_file.new: $!");