summary refs log blame commit diff stats
path: root/plugins/fishlim/keystore.c
blob: adefc7007d4fa82a10e258c04931f1f3ef63fdaf (plain) (tree)
generated by cgit-pink 1.4.1 (git 2.36.1) at 2025-02-12 22:23:03 +0000
an class="w"> defined( $id ) ) { if( grep { $id eq $_ } qw(state_cursor id) ) { $info = HexChat::get_prefs( $id ); } else { $info = HexChat::Internal::get_info( $id ); } } return $info; } sub user_info { my $nick = HexChat::strip_code(shift @_ || HexChat::get_info( "nick" )); my $user; for (HexChat::get_list( "users" ) ) { if ( HexChat::nickcmp( $_->{nick}, $nick ) == 0 ) { $user = $_; last; } } return $user; } sub context_info { my $ctx = shift @_ || HexChat::get_context; my $old_ctx = HexChat::get_context; my @fields = ( qw(away channel charset host id inputbox libdirfs modes network), qw(nick nickserv server topic version win_ptr win_status), qw(configdir xchatdir xchatdirfs state_cursor), ); if( HexChat::set_context( $ctx ) ) { my %info; for my $field ( @fields ) { $info{$field} = HexChat::get_info( $field ); } my $ctx_info = HexChat::Internal::context_info; @info{keys %$ctx_info} = values %$ctx_info; HexChat::set_context( $old_ctx ); return \%info; } else { return undef; } } sub get_list { unless( grep { $_[0] eq $_ } qw(channels dcc ignore notify users networks) ) { Carp::carp( "'$_[0]' does not appear to be a valid list name" ); } if( $_[0] eq 'networks' ) { return HexChat::List::Network->get(); } else { return HexChat::Internal::get_list( $_[0] ); } } sub strip_code { my $pattern = qr< \cB| #Bold \cC\d{0,2}(?:,\d{1,2})?| #Color \e\[(?:\d{1,2}(?:;\d{1,2})*)?m| # ANSI color code \cG| #Beep \cO| #Reset \cV| #Reverse \c_ #Underline >x; if( defined wantarray ) { my $msg = shift; $msg =~ s/$pattern//g; return $msg; } else { $_[0] =~ s/$pattern//g if defined $_[0]; } } 1