Changeset 7099
- Timestamp:
- 02/24/08 17:34:50 (5 years ago)
- Location:
- lang/perl/POE-Component-Client-Nowa/trunk
- Files:
-
- 2 modified
-
bin/nowa2ircd.pl (modified) (7 diffs)
-
config.yaml-dist (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/POE-Component-Client-Nowa/trunk/bin/nowa2ircd.pl
r6621 r7099 95 95 $heap->{channel_nicknames} = {}; 96 96 $heap->{joined} = 0; 97 $heap->{stack} = [];98 97 99 98 undef; … … 104 103 105 104 msg 'delay_nowa_recent'; 106 $heap->{nowa}->yield('recent'); 105 if ($heap->{joined}) { 106 $heap->{nowa}->yield('recent'); 107 } 107 108 } 108 109 … … 167 168 } 168 169 } 169 $kernel->delay('delay_nowa_recent', 1200); 170 $heap->{nowa}->{topics} = $res; 171 $kernel->delay('delay_nowa_channels', 1200); 170 172 } 171 173 … … 177 179 return if $heap->{nicknames}->{$nick}; 178 180 return if $nick eq $conf->{botname}; 181 $heap->{ircd}->yield(add_spoofed_nick => { nick => $nick }); 179 182 if ($ch eq $conf->{channel}) { 180 183 $heap->{joined} = 1; 181 184 $heap->{nowa}->yield(update => 'hello, world') if $heap->{config}->{greeting}; 182 185 183 for my $data (@{ $heap->{stack} }) {184 $heap->{ircd}->yield(daemon_cmd_privmsg => $data->{name}, $conf->{channel}, $data->{text});185 }186 $heap->{stack} = [];187 186 $kernel->delay('delay_nowa_recent', 5); 188 187 } else { … … 220 219 my $conf = $heap->{config}->{irc}; 221 220 222 my $nick = ( $user =~ m/^(.*)!/)[0]; 223 unless ($channel eq $conf->{channel}) { 224 $text = "$channel $text"; 225 } 226 $heap->{nowa}->yield(update => $text); 221 my $status = { status => $text }; 222 223 if ($channel ne $conf->{channel}) { 224 $status->{status} = "$channel $status->{text}"; 225 226 } elsif ($text =~ /^[\@\>]([a-z0-9\-]+):?\s+(.+)$/i) { 227 my ($nick, $body) = (lc($1), $2); 228 my %cache = map { $_->{user} => $_->{id} } reverse( @{ $heap->{previous_recent} } ); 229 230 if ($cache{$nick}) { 231 $status = { 232 parent_id => $cache{$nick}, 233 status => $body, 234 }; 235 } else { 236 $status->{status} = "$nick: $body", 237 } 238 } 239 240 $heap->{nowa}->yield(update => $status); 227 241 } 228 242 … … 248 262 } 249 263 250 # next if $heap->{config}->{nowa}->{nowa_id} eq $name; 251 if ($heap->{joined}) { 264 if ($heap->{config}->{nowa}->{nowa_id} eq $name) { 265 $heap->{ircd}->yield(daemon_cmd_topic => $conf->{botname}, $conf->{channel}, $text); 266 } else { 252 267 $heap->{ircd}->yield(daemon_cmd_privmsg => $name, $conf->{channel}, $text); 253 } else {254 push @{ $heap->{stack} }, { name => $name, text => $text }255 268 } 256 269 } 257 270 258 271 $heap->{previous_recent} = $ret; 272 273 } else { 274 $heap->{previous_recent} = []; 259 275 } 260 276 … … 285 301 } 286 302 287 # next if $heap->{config}->{nowa}->{nowa_id} eq $name; 288 $heap->{ircd}->yield(daemon_cmd_privmsg => $name, $channel, $text); 303 if ($heap->{config}->{nowa}->{nowa_id} eq $name) { 304 $heap->{ircd}->yield(daemon_cmd_topic => $conf->{botname}, $channel, $text); 305 } else { 306 $heap->{ircd}->yield(daemon_cmd_privmsg => $name, $channel, $text); 307 } 289 308 } 290 309 -
lang/perl/POE-Component-Client-Nowa/trunk/config.yaml-dist
r5295 r7099 3 3 servername: nowa.localhost 4 4 serverport: 6667 5 botname: nowa5 botname: '[nowa]' 6 6 nickname: woremacx 7 7 password: your-ircd-pass … … 10 10 11 11 nowa: 12 retry: 30012 retry: 180 13 13 nowa_id: your-nowa-id 14 14 password: your-nowa-pass 15 api_pass: your-nowa-api-pass 15 16 greeting: 0
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)