Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Local;
- use DXVars;
- use DXDebug;
- use DXUtil;
- use Redis;
- use JSON;
- # DON'T REMOVE THIS LINE
- use strict;
- # declare any global variables you use in here
- use vars qw{$redis};
- # called at initialisation time
- sub init
- {
- $redis = Redis->new(server => '127.0.0.1:6379', reconnect => 60);
- #$redis->incr("tobi");
- }
- # called after the spot has been stored but before it is broadcast,
- # you can do funky routing here that is non-standard. 0 carries on
- # after this, 1 stops dead and no routing is done (this could mean
- # that YOU have done some routing or other instead
- #
- # Parameters:-
- # $self - the DXChannel object
- # $freq - frequency
- # $spotted - the spotted callsign
- # $d - the date in unix time format
- # $text - the text of the spot
- # $spotter - who spotted it
- # $orignode - the originating node
- #
- sub spot
- {
- my ($self, $freq, $spotted, $d, $text, $spotter, $orignode) = @_;
- my %redis_spot = ('spotter'=>$spotter, 'dx'=>$spotted, 'frequency'=>$freq, 'timestamp'=>$d,
- 'comment'=>$text, 'orignode'=>$orignode);
- my $json = encode_json \%redis_spot;
- $redis->publish("dxspider_spot", $json);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement