7 use Glib
qw(G_PRIORITY_DEFAULT);
9 my $loop = Glib
::MainLoop
->new();
15 my $debug = shift || 0;
17 # Simple error handling
18 if (!$user or !$pass or !$proto) {
19 print "Syntax: $0 username password protocol\n";
24 # Initialize the wrapper
25 # Do this BEFORE initializing the libpurple internals!
26 THPPW
::thrasher_wrapper_init
(\
&timeout_add
,
34 THPPW
::thrasher_purple_debug
($debug);
36 # Initialize the beast
37 THPPW
::thrasher_init
();
40 THPPW
::thrasher_action_login
('n/a', $user, $pass, $proto);
42 # Let the eventloop fly!
46 # Thrasher Bird subrefs
53 sub subscription_add
{
56 sub connection_error
{
61 # Subrefs for which to satiate the libpurple monster
67 debug_out
("perl::timeout_add called\n");
69 debug_out
("\tinterval = $interval\n") if $interval;
70 debug_out
("\tcode = $code\n") if $code;
71 debug_out
("\ttrigger = $trigger\n") if $trigger;
73 my $ret =Glib
::Timeout
->add($interval,
77 debug_out
("Glib::Timeout->add returned [$ret]\n");
83 debug_out
("perl::timeout_remove called with $_[0]\n");
85 return Glib
::Source
->remove($_[0]);
97 debug_out
("\t$i = $_\n");
102 debug_out
("\tfd = $fd\n") if $fd;
103 debug_out
("\tcond = $cond\n") if $cond;
104 debug_out
("\tcode = $code\n") if $code;
105 debug_out
("\ttrigger = $trigger\n") if $trigger;
107 $cond = ($cond == 1) ?
'G_IO_IN' : 'G_IO_OUT';
109 my $ret = Glib
::IO
->add_watch($fd,
115 debug_out
("Glib::IO->add_watch returned [$ret]\n");