|
|
@ -20,9 +20,9 @@ my $tick_interval = 1; |
|
|
|
register_hook("protocol_add_buddy", sub { $oscar->add_buddy($ARGS{-group}, $ARGS{-buddy}); } ); |
|
|
|
register_hook("protocol_add_buddy", sub { $oscar->add_buddy($ARGS{-group}, $ARGS{-buddy}); } ); |
|
|
|
register_hook("protocol_add_buddy_group", sub { $oscar->add_buddy($ARGS{-group}); } ); |
|
|
|
register_hook("protocol_add_buddy_group", sub { $oscar->add_buddy($ARGS{-group}); } ); |
|
|
|
register_hook("protocol_away_status", sub { $is_away; } ); |
|
|
|
register_hook("protocol_away_status", sub { $is_away; } ); |
|
|
|
register_hook("protocol_chat_accept", sub { $oscar->chat_accept($chats{$ARGS{-chat}}) }); |
|
|
|
register_hook("protocol_chat_accept", sub { $oscar->chat_accept($ARGS{-url}) }); |
|
|
|
register_hook("protocol_chat_decline", sub { $oscar->chat_decline($chats{$ARGS{-chat}}); undef $chats{$ARGS{-chat}}; }); |
|
|
|
register_hook("protocol_chat_decline", sub { $oscar->chat_decline($chats{$ARGS{-url}}); delete $chats{$ARGS{-url}}; }); |
|
|
|
register_hook("protocol_chat_invite", sub { $chats{$ARGS{-chat}}->invite(@ARGS{-user, -msg}) }); |
|
|
|
register_hook("protocol_chat_invite", sub { $chats{$ARGS{-url}}->invite(@ARGS{-user, -msg}) }); |
|
|
|
register_hook("protocol_chat_join", sub { $oscar->chat_join($ARGS{-chat}) }); |
|
|
|
register_hook("protocol_chat_join", sub { $oscar->chat_join($ARGS{-chat}) }); |
|
|
|
register_hook("protocol_chat_part", sub { $chats{$ARGS{-chat}}->part; }); |
|
|
|
register_hook("protocol_chat_part", sub { $chats{$ARGS{-chat}}->part; }); |
|
|
|
register_hook("protocol_chat_send", sub { $chats{$ARGS{-chat}}->chat_send($ARGS{-msg}, !($ARGS{-reflect} or 1)) }); |
|
|
|
register_hook("protocol_chat_send", sub { $chats{$ARGS{-chat}}->chat_send($ARGS{-msg}, !($ARGS{-reflect} or 1)) }); |
|
|
@ -160,32 +160,34 @@ sub signon |
|
|
|
|
|
|
|
|
|
|
|
$oscar->set_callback_chat_invite( |
|
|
|
$oscar->set_callback_chat_invite( |
|
|
|
sub { |
|
|
|
sub { |
|
|
|
hook("protocol_chat_invited", -user => $_[1], -msg => $_[2], -url => $_[4]); |
|
|
|
$chats{$_[4]} = $_[3]; |
|
|
|
#$chats{$_[3]->{name}} = $_[3]; |
|
|
|
hook("protocol_chat_invited", -user => $_[1], -msg => $_[2], -url => $_[4]); |
|
|
|
} ); |
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
$oscar->set_callback_chat_joined( |
|
|
|
$oscar->set_callback_chat_joined( |
|
|
|
sub { |
|
|
|
sub { |
|
|
|
hook("protocol_chat_joined"); |
|
|
|
hook("protocol_chat_joined", -url => $_[2]->{url}, -name => |
|
|
|
|
|
|
|
$_[2]->{name}); |
|
|
|
} ); |
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
$oscar->set_callback_chat_closed( |
|
|
|
$oscar->set_callback_chat_closed( |
|
|
|
sub { |
|
|
|
sub { |
|
|
|
hook("protocol_chat_closed"); |
|
|
|
hook("protocol_chat_closed", -url => $_[1]->{url}); |
|
|
|
} ); |
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
$oscar->set_callback_chat_buddy_in( |
|
|
|
$oscar->set_callback_chat_buddy_in( |
|
|
|
sub { |
|
|
|
sub { |
|
|
|
hook("protocol_chat_buddy_in", -user => $_[1], -chat => $_[2]->name); |
|
|
|
hook("protocol_chat_buddy_in_" . $_[2]->{url}, |
|
|
|
print $oscar->buddy($_[1])->{comment}; |
|
|
|
-chat => $_[2]->{url}); |
|
|
|
} ); |
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
$oscar->set_callback_chat_buddy_out( |
|
|
|
$oscar->set_callback_chat_buddy_out( |
|
|
|
sub { |
|
|
|
sub { |
|
|
|
hook("protocol_chat_buddy_out", -user => $_[1], -chat => $_[2]->name); |
|
|
|
hook("protocol_chat_buddy_out_" . $_[2]->{url}, |
|
|
|
|
|
|
|
-chat => $_[2]->{url}); |
|
|
|
} ); |
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
hook("tk_getmain")->after(30, \&tick) unless option("MOSHLoop"); |
|
|
|
hook("tk_getmain")->repeat(30, \&tick) unless option("MOSHLoop"); |
|
|
|
register_hook("tick", \&tick) if option("MOSHLoop"); |
|
|
|
register_hook("tick", \&tick) if option("MOSHLoop"); |
|
|
|
|
|
|
|
|
|
|
|
$should_die = 0; |
|
|
|
$should_die = 0; |
|
|
@ -204,7 +206,6 @@ sub tick |
|
|
|
{ |
|
|
|
{ |
|
|
|
return unless $oscar; |
|
|
|
return unless $oscar; |
|
|
|
$oscar->do_one_loop; |
|
|
|
$oscar->do_one_loop; |
|
|
|
hook("tk_getmain")->after(30, \&tick) unless $should_die || option("MOSHLoop"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sub request_info |
|
|
|
sub request_info |
|
|
|