Changeset 6858d2d
- Timestamp:
- Jan 9, 2008, 11:14:20 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:
- 47b6a5f
- Parents:
- 6286f26
- git-author:
- Nelson Elhage <nelhage@mit.edu> (01/09/08 23:13:52)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (01/09/08 23:14:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r6286f26 r6858d2d 64 64 BarnOwl::new_command('irc-disconnect' => \&cmd_disconnect); 65 65 BarnOwl::new_command('irc-msg' => \&cmd_msg); 66 BarnOwl::new_command('irc-join' => \&cmd_join); 67 BarnOwl::new_command('irc-nick' => \&cmd_nick); 66 BarnOwl::new_command('irc-join' => \&cmd_join); 67 BarnOwl::new_command('irc-part' => \&cmd_part); 68 BarnOwl::new_command('irc-nick' => \&cmd_nick); 69 BarnOwl::new_command('irc-names' => \&cmd_names); 68 70 } 69 71 … … 148 150 my $msg = BarnOwl::Message->new( 149 151 type => 'IRC', 150 direction => 'out',152 direction => is_private($to) ? 'out' : 'in', 151 153 server => $conn->server, 152 154 network => $conn->alias, … … 169 171 } 170 172 173 sub cmd_part { 174 my $cmd = shift; 175 my $conn = get_connection(\@_); 176 my $chan = get_channel(\@_) || die("Usage: $cmd <channel>"); 177 $conn->part($chan); 178 } 179 171 180 sub cmd_nick { 172 181 my $cmd = shift; … … 174 183 my $nick = shift or die("Usage: $cmd <new nick>"); 175 184 $conn->nick($nick); 185 } 186 187 sub cmd_names { 188 my $cmd = shift; 189 my $conn = get_connection(\@_); 190 my $chan = get_channel(\@_) || die("Usage: $cmd <channel>"); 191 $conn->names($chan); 176 192 } 177 193 … … 196 212 } 197 213 214 sub get_channel { 215 my $args = shift; 216 if(scalar @$args) { 217 return shift @$args; 218 } 219 my $m = BarnOwl::getcurmsg(); 220 if($m && $m->type eq 'IRC') { 221 return $m->channel if !$m->is_private; 222 } 223 return undef; 224 } 225 198 226 sub get_connection_by_alias { 199 227 my $key = shift;
Note: See TracChangeset
for help on using the changeset viewer.