Changeset b0c8011 for perl/modules/IRC
- Timestamp:
- Jan 10, 2008, 11:25:27 PM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 9e02bb7
- Parents:
- 65fea01
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
rb10f340 rb0c8011 84 84 85 85 sub register_commands { 86 BarnOwl::new_command('irc-connect' => \&cmd_connect); 86 BarnOwl::new_command('irc-connect' => \&cmd_connect, 87 { 88 summary => 'Connect to an IRC server', 89 usage => 'irc-connect [-a ALIAS ] [-s] [-p PASSWORD] [-n NICK] SERVER [port]', 90 description => 91 92 "Connect to an IRC server. Supported options are\n\n" . 93 "-a <alias> Define an alias for this server\n" . 94 "-s Use SSL\n" . 95 "-p <password> Specify the password to use\n" . 96 "-n <nick> Use a non-default nick" 97 }); 87 98 BarnOwl::new_command('irc-disconnect' => \&cmd_disconnect); 88 BarnOwl::new_command('irc-msg' => \&cmd_msg); 89 BarnOwl::new_command('irc-join' => \&cmd_join); 90 BarnOwl::new_command('irc-part' => \&cmd_part); 91 BarnOwl::new_command('irc-nick' => \&cmd_nick); 92 BarnOwl::new_command('irc-names' => \&cmd_names); 99 BarnOwl::new_command('irc-msg' => \&cmd_msg); 100 BarnOwl::new_command('irc-join' => \&cmd_join); 101 BarnOwl::new_command('irc-part' => \&cmd_part); 102 BarnOwl::new_command('irc-nick' => \&cmd_nick); 103 BarnOwl::new_command('irc-names' => \&cmd_names); 104 BarnOwl::new_command('irc-whois' => \&cmd_whois); 93 105 } 94 106 … … 119 131 "ssl" => \$ssl, 120 132 "password=s" => \$password, 121 "port=i" => \$port,122 133 "nick=s" => \$nick, 123 134 ); 124 135 $host = shift @ARGV or die("Usage: $cmd HOST\n"); 125 136 if(!$alias) { 126 $alias = $1 if $host =~ /^(?:irc[.])?(\w+)[.]\w+$/; 127 $alias ||= $host; 137 if($host =~ /^(?:irc[.])?(\w+)[.]\w+$/) { 138 $alias = $1; 139 } else { 140 $alias = $host; 141 } 128 142 } 129 $port ||=6667;143 $port = shift @ARGV || 6667; 130 144 $ssl ||= 0; 145 } 146 147 if(exists $ircnets{$alias}) { 148 die("Already connected to a server with alias '$alias'. Either disconnect or specify an alias with -a.\n"); 131 149 } 132 150 … … 198 216 my $cmd = shift; 199 217 my $conn = get_connection(\@_); 200 my $chan = get_channel(\@_) || die("Usage: $cmd <channel> ");218 my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n"); 201 219 $conn->part($chan); 202 220 } … … 205 223 my $cmd = shift; 206 224 my $conn = get_connection(\@_); 207 my $nick = shift or die("Usage: $cmd <new nick> ");225 my $nick = shift or die("Usage: $cmd <new nick>\n"); 208 226 $conn->nick($nick); 209 227 } … … 212 230 my $cmd = shift; 213 231 my $conn = get_connection(\@_); 214 my $chan = get_channel(\@_) || die("Usage: $cmd <channel> ");232 my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n"); 215 233 $conn->names($chan); 234 } 235 236 sub cmd_whois { 237 my $cmd = shift; 238 my $conn = get_connection(\@_); 239 my $who = shift || die("Usage: $cmd <user>\n"); 240 $conn->whois($who); 216 241 } 217 242
Note: See TracChangeset
for help on using the changeset viewer.