- %friends = %nicks = ();
-
- $twit = Net::Twitter->new(
- username => $user,
- password => $pass,
- source => "twirssi"
- );
-
- unless ( $twit->verify_credentials() ) {
- ¬ice("Login as $user failed");
- $twit = undef;
- if ( keys %twits ) {
- &cmd_switch( ( keys %twits )[0], $server, $win );
- }
- return;
- }
-
- if ($twit) {
- my $rate_limit = $twit->rate_limit_status();
- if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
- ¬ice(
- "Rate limit exceeded, try again after $rate_limit->{reset_time}"
- );
- $twit = undef;
- return;
- }
-
- $twits{$user} = $twit;
- Irssi::timeout_remove($poll) if $poll;
- $poll = Irssi::timeout_add( &get_poll_time * 1000, \&get_updates, "" );
- ¬ice("Logged in as $user, loading friends list...");
- &load_friends();
- ¬ice( "loaded friends: ", scalar keys %friends );
- if ( Irssi::settings_get_bool("twirssi_first_run") ) {
- Irssi::settings_set_bool( "twirssi_first_run", 0 );
- unless ( exists $friends{twirssi} ) {
- ¬ice("Welcome to twirssi!"
- . " Perhaps you should add \@twirssi to your friends list,"
- . " so you can be notified when a new version is release?"
- . " Just type /twitter_friend twirssi." );
- }
- }
- %nicks = %friends;
- $nicks{$user} = 0;
- &get_updates;
- } else {
- ¬ice("Login failed");
- }
-}
-
-sub cmd_login_identica {
- my ( $data, $server, $win ) = @_;
- my $pass;
- if ($data) {
- ( $user, $pass ) = split ' ', $data, 2;
- } elsif ( my $autouser = Irssi::settings_get_str("twitter_usernames_identica")
- and my $autopass = Irssi::settings_get_str("twitter_passwords_identica") )
- {
- my @user = split /\s*,\s*/, $autouser;
- my @pass = split /\s*,\s*/, $autopass;
- if ( @user != @pass ) {