Skip to content
Tom Feist edited this page Oct 10, 2011 · 37 revisions

Irssi::Channel

home | Irssi
   ATTRIBUTES
   METHODS
   destroy
   bans
   ban_get_mask $nick, $ban_type
   banlist_add $ban, $nick, $time
   banlist_remove $ban
   nick_insert $nick, $op, $voice, $send_massjoin
   nick_remove $nick
   nick_find $nick
   nick_find_mask $mask
   nicks

ATTRIBUTES

Channel->{}

type - "CHANNEL" text
chat_type - String ID of chat protocol, for example "IRC"

(..contains all the same data as [[Windowitem]] above..)

topic - Channel topic
topic_by - Nick who set the topic
topic_time - Timestamp when the topic was set

no_modes - Channel is modeless
mode - Channel mode
limit - Max. users in channel (+l mode)
key - Channel key (password)

chanop - You are channel operator
names_got - /NAMES list has been received
wholist - /WHO list has been received
synced - Channel is fully synchronized

joined - JOIN event for this channel has been received
left - You just left the channel (for "channel destroyed" event)
kicked - You was just kicked out of the channel (for
         "channel destroyed" event)

METHODS

destroy

Destroy the channel object.

bans

Return a list of bans in channel.

ban_get_mask $nick, $ban_type

Get ban mask for $nick.

$ban_type is an integer bitmask, taking one of the following values:

  • Irssi::Irc::MASK_NICK 0x01

  • Irssi::Irc::MASK_USER 0x02

  • Irssi::Irc::MASK_HOST 0x04

  • Irssi::Irc::MASK_DOMAIN 0x08

banlist_add $ban, $nick, $time

Add a new ban to channel.

banlist_remove $ban

Remove a ban from channel.

nick_insert $nick, $op, $voice, $send_massjoin

Add a Irssi::Nick object $nick to the channel nicklist. Returns a (TODO: the same?) Irssi::Nick object.

TODO: Document other flags.

nick_remove $nick

Remove nick from nicklist.

nick_find $nick

Find a nick in the channel nicklist. Returns an Irssi::Nick object.

# fetch the Irssi::Nick object for the user 'anon'.
my $anon_nick = Irssi::active_win()->{active}->nick_find('anon');

nick_find_mask $pattern

Find a nick matching $pattern in the nicklist, with wildcards allowed. Returns an Irssi::Nick object.

Note: Even if multiple nickmasks match $pattern, only a single result will be returned and the index of that match is essentially arbitrary, and may potentially change as users join and part the channel.

# fetch the Irssi::Nick object for the user 'anonymous!*@*'.
my $anon_nick = Irssi::active_win()->{active}->nick_find_mask('anonymous!*@*');

nicks

Returns a list of all nicks in the specified channel.

This method can be filtered to provide functionality similar to nick_find_mask() whilst retaining the ability to return multiple results.

For example:

my $target_mask = 'anon*!*@*';

my $server  = Irssi::active_server();
my $channel = Irssi::active_win()->{active};

sub check_nick {
    my ($mask, $nick) = @_;
    return $server->mask_match_address($mask, $nick->{nick}, $nick->{host});
}

my @anon_matches = grep { check_nick($target_mask, $_) } $channel->nicks();

Clone this wiki locally