Wed, 13 May 2009 20:29:03 +0000
Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
1 | use Purple; |
| 11170 | 2 | |
| 3 | %PLUGIN_INFO = ( | |
| 4 | perl_api_version => 2, | |
| 5 | name => "Countdown Info Timer", | |
| 6 | version => "0.1", | |
| 7 | summary => "Makes a countdown in days from today.", | |
| 8 | description => "Long description coming....", | |
| 9 | author => "John H. Kelm <johnhkelm\@gmail.com>", | |
|
16241
0c4919abc3b7
Point to the Pidgin website.
Richard Laager <rlaager@pidgin.im>
parents:
15894
diff
changeset
|
10 | url => "http://pidgin.im", |
| 11170 | 11 | |
| 12 | load => "plugin_load", | |
| 13 | unload => "plugin_unload" | |
| 14 | ); | |
| 15 | ||
| 16 | $GLOBAL_TEST_VAR = "STUFF!"; | |
| 17 | ||
| 18 | sub plugin_unload { | |
| 19 | my $plugin = shift; | |
| 20 | } | |
| 21 | ||
| 22 | sub plugin_init { | |
| 23 | return %PLUGIN_INFO; | |
| 24 | } | |
| 25 | ||
| 26 | ||
| 27 | sub plugin_load { | |
| 28 | my $plugin = shift; | |
| 29 | ||
| 30 | # Retrieve all the accounts | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
31 | @accounts = Purple::Accounts::get_all(); |
| 11170 | 32 | |
| 33 | print "NUM OF ACCS: " . $accounts . "\n"; | |
| 34 | # Search each account's user info for our tag | |
| 35 | foreach $acc (@accounts) { | |
| 36 | print "IN ACCOUNTS\n"; | |
| 12364 | 37 | $user_info = $acc->get_user_info(); |
| 11170 | 38 | print "USER INFO 1: " . $user_info . "\n"; |
| 39 | # Find <countdown> and replace | |
| 40 | $user_info =~ /countdown([0-9]+).([0-9]+).([0-9]+)/; | |
| 41 | print "Found: " .$1 . " " . $2 . " " . $3 . "\n"; | |
| 42 | $days = count_days($1, $2, $3); | |
| 43 | $user_info =~ s/countdown(\d\d\d\d).(\d\d).(\d\d)/$days/; | |
| 44 | print "USER INFO 2: " . $user_info . "\n"; | |
| 12364 | 45 | # $acc->set_user_info($user_info); |
| 11170 | 46 | |
| 47 | } | |
| 48 | ||
| 49 | eval ' | |
| 50 | use Gtk2 \'-init\'; | |
| 51 | use Glib; | |
| 52 | $window = Gtk2::Window->new(\'toplevel\'); | |
| 53 | $window->set_border_width(10); | |
| 54 | $button = Gtk2::Button->new("Hello World"); | |
| 55 | $button->signal_connect(clicked => \&hello, $window); | |
| 56 | ||
| 57 | $window->add($button); | |
| 58 | $button->show; | |
| 59 | $window->show; | |
| 60 | # Gtk2->main; | |
| 61 | ||
| 62 | 0; | |
| 63 | ||
| 64 | '; warn $@ if $@; | |
| 65 | } | |
| 66 | ||
| 67 | sub hello { | |
| 68 | my ($widget, $window) = @_; | |
| 69 | print "Called from sub hello!\n "; | |
| 70 | print "Test var: " . $GLOBAL_TEST_VAR . " \n"; | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
71 | @accounts = Purple::Accounts::get_all(); |
| 11170 | 72 | $acc = $accounts[0]; |
| 12364 | 73 | $user_info = $acc->get_user_info(); |
| 11170 | 74 | print "USER INFO from sub hello: " . $user_info . "\n"; |
| 75 | $window->destroy; | |
| 76 | } | |
| 77 | ||
| 78 | sub count_days { | |
| 79 | ($year, $month, $day) = @_; | |
| 80 | ||
| 81 | ||
| 82 | eval ' | |
| 83 | use Time::Local; | |
| 84 | $future = timelocal(0,0,0,$day,$month-1,$year); | |
| 85 | '; warn $@ if $@; | |
| 86 | $today = time(); | |
| 87 | $days = int(($future - $today)/(60*60*24)); | |
| 88 | return $days; | |
| 89 | } |