Revision: 980
Author: andy
Date: 2009-07-26 04:37:38 +0000 (Sun, 26 Jul 2009)
ViewCVS:
https://svn.bitfolk.com/view/?rev=980&view=rev
Log Message:
-----------
Check for new friends/tweets when receiving a HUP signal
Modified Paths:
--------------
twitfolk/trunk/twitfolk.pl
Modified: twitfolk/trunk/twitfolk.pl
===================================================================
--- twitfolk/trunk/twitfolk.pl 2009-07-26 04:07:13 UTC (rev 979)
+++ twitfolk/trunk/twitfolk.pl 2009-07-26 04:37:38 UTC (rev 980)
@@ -4,11 +4,12 @@
=pod
-twitfolk
+TwitFolk
-Gate tweets from your Twitter friends into an IRC channel. Currently can be
-found on
irc://irc.bitfolk.com/bitfolk as the user "Twitfolk".
+Gate tweets from your Twitter/Identi.ca friends into an IRC channel.
+
http://dev.bitfolk.com/twitfolk/
+
Copyright ©2008 Andy Smith <andy+twitfolk.pl@???>
Artistic license same as Perl.
@@ -53,6 +54,7 @@
my $DEBUG = $ENV{'IRC_DEBUG'} || 0;
my $time_to_die = 0;
+my $reload = 0;
if ($config{use_identica}) {
if (qv($Net::Twitter::VERSION) >= qv('2.0')) {
@@ -103,6 +105,14 @@
$irc->do_one_loop();
do_timers_once($conn);
do_timers_repeat($conn);
+
+ if ($reload) {
+ $reload = 0;
+ # Someone sent HUP signal
+ irc_debug("Caught SIGHUP");
+ update_friends($conn);
+ check_tweets($conn);
+ }
}
if ($conn) {
@@ -294,9 +304,12 @@
{
my ($self, $event) = @_;
- my $vstring = sprintf("VERSION twitfolk v%s " .
- "(\002grifferz\002 is responsible for this atrocity)", $version);
+ my $svnid = '$Id$';
+ my $home = '
http://dev.bitfolk.com/twitfolk/';
+ my $vstring = sprintf("VERSION TwitFolk v%s (%s) - %s", $version, $svnid,
+ $home);
+
$self->ctcp_reply($event->nick, $vstring);
}
@@ -319,6 +332,11 @@
$time_to_die = 1;
}
+sub handle_sig_hup
+{
+ $reload = 1;
+}
+
=pod
Splurge the perl error to IRC for the amusement of others.
@@ -338,6 +356,7 @@
{
$SIG{__DIE__} = \&handle_perl_death;
$SIG{INT} = $SIG{TERM} = \&handle_sig_int_term;
+ $SIG{HUP} = \&handle_sig_hup;
# Only daemonize if not running debug mode
return if ($DEBUG);