From e251095e4a33615f0ff99e2f238f9e48814f4950 Mon Sep 17 00:00:00 2001 From: Dan Boger Date: Mon, 11 Jan 2010 23:40:25 -0800 Subject: [PATCH] Improve oauth with multiple accounts --- twirssi.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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: $!"); -- 2.30.2