Mercurial > pidgin.yaz
comparison plugins/fortuneprofile.pl @ 6529:e4e87ffd9f14
[gaim-migrate @ 7046]
The fortunateprofile.pl script works again. At least, I think it works, but
it's never worked here, but all the events and suff work, so that's good,
and i added a test.pl that people acan also see. now I'm going to bebd.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 20 Aug 2003 11:08:19 +0000 |
parents | 7f0fffa1077b |
children | 540edd51051b |
comparison
equal
deleted
inserted
replaced
6528:390807f638b1 | 6529:e4e87ffd9f14 |
---|---|
40 # | 40 # |
41 # You should have received a copy of the GNU General Public License | 41 # You should have received a copy of the GNU General Public License |
42 # along with this program; if not, write to the Free Software | 42 # along with this program; if not, write to the Free Software |
43 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 43 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
44 | 44 |
45 use Gaim; | |
46 | |
45 %PLUGIN_INFO = ( | 47 %PLUGIN_INFO = ( |
46 perl_api_version => 2, | 48 perl_api_version => 2, |
47 name => "Fortune Profile", | 49 name => "Fortune Profile", |
48 version => "3.4", | 50 version => "3.4", |
49 summary => "Sets your AIM profile to a fortune (with a header and footer of your choice).", | 51 summary => "Sets your AIM profile to a fortune (with a header and footer of your choice).", |
57 sub plugin_init { | 59 sub plugin_init { |
58 return %PLUGIN_INFO; | 60 return %PLUGIN_INFO; |
59 } | 61 } |
60 | 62 |
61 sub plugin_load { | 63 sub plugin_load { |
62 my $plugin = shift; | 64 $plugin = shift; |
63 | 65 |
64 $tab = " "; | 66 $tab = " "; |
65 $tab = $tab . $tab . $tab . $tab; | 67 $tab = $tab . $tab . $tab . $tab; |
66 $nl = "<BR>"; | 68 $nl = "<BR>"; |
67 | 69 |
79 if ($post_message ne "") { | 81 if ($post_message ne "") { |
80 $len += length("---$nl" . $post_message); | 82 $len += length("---$nl" . $post_message); |
81 } | 83 } |
82 | 84 |
83 # Command to get dynamic message from | 85 # Command to get dynamic message from |
84 $command = "fortune -sn " . ($max - $len); | 86 $command = "fortune -sn " . ($max - $len); |
85 | 87 |
88 $seconds = 10; # Delay before updating away messages. | |
86 # output the first message and start the timers... | 89 # output the first message and start the timers... |
87 # This is done as a timeout to prevent attempts to set the | 90 # This is done as a timeout to prevent attempts to set the |
88 # profile before logging in. | 91 # profile before logging in. |
89 Gaim::timeout_add($plugin, $seconds, "update_away"); | 92 Gaim::timeout_add($plugin, $seconds, "update_away", NULL); |
90 } | 93 } |
91 | 94 |
92 sub update_away { | 95 sub update_away { |
93 # The fortunes are expanded into HTML (the tabs and newlines) which | 96 # The fortunes are expanded into HTML (the tabs and newlines) which |
94 # causes the -s option of fortune to be a little bit meaningless. This | 97 # causes the -s option of fortune to be a little bit meaningless. This |
111 } | 114 } |
112 if ($post_message ne "") { | 115 if ($post_message ne "") { |
113 $message = $message . "---$nl" . $post_message ; | 116 $message = $message . "---$nl" . $post_message ; |
114 } | 117 } |
115 | 118 |
116 foreach $id (GAIM::get_info(1)) {GAIM::command("info", $id, $message);} | 119 foreach $account (Gaim::accounts()) { |
117 GAIM::add_timeout_handler($handle, $seconds, "update_away"); | 120 if ($account->is_connected()) { |
121 $account->set_user_info($message); | |
122 } | |
123 } | |
124 | |
125 Gaim::timeout_add($plugin, $seconds, "update_away", NULL); | |
118 } | 126 } |
119 | 127 |
120 | 128 |