Skip to content

Instantly share code, notes, and snippets.

@farhaven
Created March 27, 2010 15:40
Show Gist options
  • Save farhaven/346164 to your computer and use it in GitHub Desktop.
Save farhaven/346164 to your computer and use it in GitHub Desktop.
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '0.2';
%IRSSI = (
authors => 'gbe/smile',
name => 'bitlbee_autojoin_groupchats',
description => 'autojoins groupchats in bitlbee',
license => 'MIT'
);
my %groupchats = (
'jabber' => [
'[email protected]',
]
);
sub autojoin_groupchat
{
my ($server, $data, $nick, $adress) = @_;
my ($target, $msg) = split(/ :/, $data, 2);
if (($target eq "&bitlbee") && ($msg =~ /(.+) - Logging in: Logged in/))
{
my $account = $1;
my @chats = @{$groupchats{$account} or [] };
foreach my $c (@chats)
{
$server->send_message($target, 'join_chat ' . $account . ' ' . $c, 0);
}
}
}
Irssi::signal_add('event privmsg', 'autojoin_groupchat');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment