CInfo Hook

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Fr3DBr
Developers
Developers
Posts: 60
Joined: 05 Oct 2011, 09:21
Noob?: No
Location: Brazil

CInfo Hook

#1 Post by Fr3DBr »

Hey, i needed this hook to some of my projects and might be useful to other ppl, so we have it in default version :)

This is the Chat Info Hook.

Find :

Code: Select all

sub chat_info {
	my ($self, $args) = @_;

	my $title;
	$self->decrypt(\$title, $args->{title});
	$title = bytesToString($title);

	my $chat = $chatRooms{$args->{ID}};
	if (!$chat || !%{$chat}) {
		$chat = $chatRooms{$args->{ID}} = {};
		binAdd(\@chatRoomsID, $args->{ID});
	}
...
Change To :

Code: Select all

sub chat_info {
	my ($self, $args) = @_;

	my $title;
	$self->decrypt(\$title, $args->{title});
	$title = bytesToString($title);

	my $chat = $chatRooms{$args->{ID}};
	if (!$chat || !%{$chat}) {
		$chat = $chatRooms{$args->{ID}} = {};
		binAdd(\@chatRoomsID, $args->{ID});
	}
	$chat->{title} = $title;
	$chat->{ownerID} = $args->{ownerID};
	$chat->{limit} = $args->{limit};
	$chat->{public} = $args->{public};
	$chat->{num_users} = $args->{num_users};
	
	Plugins::callHook('packet_chatinfo', {
		title => $title,
		ownerID => $args->{ownerID},
		limit => $args->{limit},
		public => $args->{public},
		num_users => $args->{num_users}
	});
}
Have fun guys.