Rest of renaming.
This commit is contained in:
1 parent
12ed97b398
commit
60edbba15d
1 file changed
+15
-15
+15
-15
@@ -1,31 +1,31 @@
|
||||
# lib/Lib/Users.pm - Library for user tracking.
|
||||
# lib/Core/IRC/Users.pm - IRC user tracking.
|
||||
# Copyright (C) 2010-2011 Xelhua Development Group, et al.
|
||||
# This program is free software; rights to this code are stated in doc/LICENSE.
|
||||
package Lib::Users;
|
||||
package Core::IRC::Users;
|
||||
use strict;
|
||||
use warnings;
|
||||
use API::Std qw(hook_add);
|
||||
our %users;
|
||||
|
||||
# Initialize the libusers_create and libusers_delete events.
|
||||
API::Std::event_add('libusers_create');
|
||||
API::Std::event_add('libusers_delete');
|
||||
# Initialize the ircusers_create and ircusers_delete events.
|
||||
API::Std::event_add('ircusers_create');
|
||||
API::Std::event_add('ircusers_delete');
|
||||
|
||||
# Create the on_rcjoin hook.
|
||||
hook_add('on_rcjoin', 'libusers.onjoin', sub {
|
||||
hook_add('on_rcjoin', 'ircusers.onjoin', sub {
|
||||
my ($src, $chan) = @_;
|
||||
|
||||
# Add the user to the users hash, if not already defined.
|
||||
if (!$users{$src->{svr}}{lc $src->{nick}}) {
|
||||
$users{$src->{svr}}{lc $src->{nick}} = $src->{nick};
|
||||
API::Std::event_run('libusers_create', ($src->{svr}, $src->{nick}));
|
||||
API::Std::event_run('ircusers_create', ($src->{svr}, $src->{nick}));
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Create the on_namesreply hook.
|
||||
hook_add('on_namesreply', 'libusers.names', sub {
|
||||
hook_add('on_namesreply', 'ircusers.names', sub {
|
||||
my ($svr, $chan, undef) = @_;
|
||||
|
||||
# Iterate through the users for this channel.
|
||||
@@ -41,7 +41,7 @@ hook_add('on_namesreply', 'libusers.names', sub {
|
||||
});
|
||||
|
||||
# Create the on_whoreply hook.
|
||||
hook_add('on_whoreply', 'libusers.who', sub {
|
||||
hook_add('on_whoreply', 'ircusers.who', sub {
|
||||
my ($svr, $nick, undef) = @_;
|
||||
|
||||
# Ensure it is not us.
|
||||
@@ -57,7 +57,7 @@ hook_add('on_whoreply', 'libusers.who', sub {
|
||||
});
|
||||
|
||||
# Create the on_nick hook.
|
||||
hook_add('on_nick', 'libusers.onnick', sub {
|
||||
hook_add('on_nick', 'ircusers.onnick', sub {
|
||||
my ($src, $newnick) = @_;
|
||||
|
||||
# Modify the user's entry in the users hash.
|
||||
@@ -70,7 +70,7 @@ hook_add('on_nick', 'libusers.onnick', sub {
|
||||
});
|
||||
|
||||
# Create the on_kick hook.
|
||||
hook_add('on_kick', 'libusers.onkick', sub {
|
||||
hook_add('on_kick', 'ircusers.onkick', sub {
|
||||
my ($src, $kchan, $user, undef) = @_;
|
||||
|
||||
# Ensure there is a users hash entry for this user.
|
||||
@@ -85,7 +85,7 @@ hook_add('on_kick', 'libusers.onkick', sub {
|
||||
if (!$ri) {
|
||||
# They are not, delete them.
|
||||
delete $users{$src->{svr}}{lc $user};
|
||||
API::Std::event_run('libusers_delete', ($src->{svr}, $user));
|
||||
API::Std::event_run('ircusers_delete', ($src->{svr}, $user));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ hook_add('on_kick', 'libusers.onkick', sub {
|
||||
});
|
||||
|
||||
# Create the on_part hook.
|
||||
hook_add('on_part', 'libusers.onpart', sub {
|
||||
hook_add('on_part', 'ircusers.onpart', sub {
|
||||
my ($src, $pchan, undef) = @_;
|
||||
|
||||
# Ensure there is a users hash entry for this user.
|
||||
@@ -108,7 +108,7 @@ hook_add('on_part', 'libusers.onpart', sub {
|
||||
if (!$ri) {
|
||||
# They are not, delete them.
|
||||
delete $users{$src->{svr}}{lc $src->{nick}};
|
||||
API::Std::event_run('libusers_delete', ($src->{svr}, $src->{nick}));
|
||||
API::Std::event_run('ircusers_delete', ($src->{svr}, $src->{nick}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ hook_add('on_part', 'libusers.onpart', sub {
|
||||
});
|
||||
|
||||
# Create the on_quit hook.
|
||||
hook_add('on_quit', 'libusers.onquit', sub {
|
||||
hook_add('on_quit', 'ircusers.onquit', sub {
|
||||
my ($src, undef) = @_;
|
||||
|
||||
# Delete the user's entry from the users hash.
|
||||
|
||||
Reference in new issue
Block a user