Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: POE::Component::IRC event loop stuck?

by GodEater (Initiate)
on Aug 12, 2015 at 10:04 UTC ( #1138300=note: print w/replies, xml ) Need Help??


in reply to Re: POE::Component::IRC event loop stuck?
in thread POE::Component::IRC event loop stuck?

I was trying to limit the amount of code I posted, but clearly I have left some key pieces out ;). Here is the joina nd part events from the code I'm working with, which try to do some of what you have suggested:

sub irc_join { my $heap = $_[HEAP]; my $nick = ( split /!/, $_[ARG0] )[0]; my $channel = $_[ARG1]; my $hash_channel = (split /#/, $channel)[1]; my $irc = $_[SENDER]->get_heap(); my $joincount = $heap->{joincount}; my $batch_of_channels = $heap->{batch_of_channels_hash}; my $verbose = $heap->{verbose}; my $message = $heap->{cleanup_message}; my $nickname = $heap->{nickname}; my $channel_db = $heap->{channel_info_db}; $logger->info("Got join event from $channel as $$nickname - person + joining was $nick"); if ( $nick eq $irc->nick_name() ) { # Number of channels joined $$joincount++; $logger->info("Which is $$joincount channels joined now"); # Only send the message if we're the one joining $logger->info("Messaging $channel"); # Mark the channel as joined $batch_of_channels->{$hash_channel}{joined} = 1; # Mark the channel as "being messaged" in the database, so it +won't get selected in lock_channels.pl by mistake my $data_entry = $channel_db->resultset('Channel')->find({name + => $hash_channel}); $data_entry->being_messaged('true'); $data_entry->update; $irc->yield(privmsg => $channel, $message); $irc->yield(part => $channel); } return; } sub irc_part { my $heap = $_[HEAP]; my $nick = ( split /!/, $_[ARG0] )[0]; my $channel = $_[ARG1]; my $hash_channel = (split /#/, $channel)[1]; my $part_msg = $_[ARG2]; my $irc = $_[SENDER]->get_heap(); my $joincount = $heap->{joincount}; my $batch_of_channels = $heap->{batch_of_channels_hash}; my $verbose = $heap->{verbose}; my $message = $heap->{cleanup_message}; my $nickname = $heap->{nickname}; my $channel_db = $heap->{channel_info_db}; $logger->info("Got part event from $channel as $$nickname - person + leaving was $nick"); if ($nick eq $irc->nick_name()) { $$joincount--; $logger->info("Left a channel, so $$joincount channels joined +now"); $batch_of_channels->{$hash_channel}{joined} = 0; } }

Replies are listed 'Best First'.
Re^3: POE::Component::IRC event loop stuck?
by PilotinControl (Pilgrim) on Aug 12, 2015 at 16:13 UTC

    I've written an extensive bot using Net-IRC...even though this is an out dated and no longer developed Perl Module I have used it since it was originally coded and has run on a good sized IRC network since 2001.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1138300]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2022-01-29 01:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (74 votes). Check out past polls.

    Notices?