Browse files

Add USERINFO command to modules/basecmds.pm

  • Loading branch information...
1 parent acd29c1 commit ace9f3f18abc3ffddd3e2c4780339cbc15ba7e82 @incognico committed Jun 4, 2013
Showing with 22 additions and 0 deletions.
  1. +22 −0 modules/basecmds.pm
View
22 modules/basecmds.pm
@@ -246,6 +246,28 @@ sub on_privmsg {
main::hlp($target, 'syntax: LIST(LS) CHANNELS(CHANS) | LIST(LS) NAMES <channel>');
}
}
+ elsif ($cmd eq 'USERINFO' || $cmd eq 'UI') {
+ if ($args[0]) {
+ my $count = 0;
+ my $userchans;
+
+ for my $chans (keys(%{$mychannels->{$$myprofile}})) {
+ for (keys(%{$mychannels->{$$myprofile}{$chans}})) {
+ if (lc($_) eq lc($args[0])) {
+ $userchans .= $chans . ', ';
+ $count++;
+ }
+ }
+ }
+
+ if ($count > 0) {
+ main::msg($target, '%s is in %d common channel(s): %s', $args[0], $count, substr($userchans, 0, -2));
+ }
+ else {
+ main::msg($target, 'no result');
+ }
+ }
+ }
elsif ($cmd eq 'MSG') {
if ($args[1]) {
main::msg($args[0], join(' ', @args[1..$#args]));

0 comments on commit ace9f3f

Please sign in to comment.