comparison plugins/fortuneprofile.pl @ 6125:e8204ffce9f8

[gaim-migrate @ 6599] Make fortuneprofile.pl not infinite loop when you don't have fortune installed. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 15 Jul 2003 01:01:38 +0000
parents 3b0acfecf094
children 7f0fffa1077b
comparison
equal deleted inserted replaced
6124:16fd7811effd 6125:e8204ffce9f8
36 # You should have received a copy of the GNU General Public License 36 # You should have received a copy of the GNU General Public License
37 # along with this program; if not, write to the Free Software 37 # along with this program; if not, write to the Free Software
38 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 38 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 39
40 40
41 $handle = GAIM::register("Fortune Profile", "3.2", "", ""); 41 $handle = GAIM::register("Fortune Profile", "3.3", "", "");
42 42
43 $tab = "&nbsp;"; 43 $tab = "&nbsp;";
44 $tab = $tab . $tab . $tab . $tab; 44 $tab = $tab . $tab . $tab . $tab;
45 $nl = "<BR>"; 45 $nl = "<BR>";
46 46
67 # will loop until it gets a fortune of a good size (after expansion). 67 # will loop until it gets a fortune of a good size (after expansion).
68 68
69 do { 69 do {
70 do { #It's a while loop because it doesn't always work for some reason 70 do { #It's a while loop because it doesn't always work for some reason
71 $fortune = `$command`; 71 $fortune = `$command`;
72 if ($? == -1) {
73 return;
74 }
72 } while ($fortune eq ""); 75 } while ($fortune eq "");
73 $fortune =~ s/\n/$nl/g; 76 $fortune =~ s/\n/$nl/g;
74 $fortune =~ s/\t/$tab/g; 77 $fortune =~ s/\t/$tab/g;
75 } while ((length($fortune) + $len ) > $max); 78 } while ((length($fortune) + $len ) > $max);
76 79
86 GAIM::add_timeout_handler($handle, $seconds, "update_away"); 89 GAIM::add_timeout_handler($handle, $seconds, "update_away");
87 } 90 }
88 91
89 sub description { 92 sub description {
90 my($a, $b, $c, $d, $e, $f) = @_; 93 my($a, $b, $c, $d, $e, $f) = @_;
91 ("Fortune Profile", "3.2", "Sets your AIM profile to a fortune (with a header and footer of your choice).", 94 ("Fortune Profile", "3.3", "Sets your AIM profile to a fortune (with a header and footer of your choice).",
92 "Sean Egan &lt;bj91704\@binghamton.edu>", "http://gaim.sf.net/", 95 "Sean Egan <bj91704\@binghamton.edu>", "http://gaim.sf.net/",
93 "/dev/null"); 96 "/dev/null");
94 } 97 }
95 98
96 # output the first message and start the timers... 99 # output the first message and start the timers...
97 # This is done as a timeout to prevent attempts to set the profile before logging in. 100 # This is done as a timeout to prevent attempts to set the profile before logging in.