Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- use warnings;
- use utf8;
- use locale;
- #use Encode;
- #use encoding 'utf8';
- use AnyEvent;
- use AnyEvent::XMPP::Client;
- use AnyEvent::XMPP::Ext::Disco;
- #use AnyEvent::XMPP::Ext::Version;
- use AnyEvent::XMPP::Namespaces qw/xmpp_ns/;
- #use AnyEvent::XMPP::IM::Connection;
- #my $jCon = AnyEvent::XMPP::IM::Connection->new(
- # username => "bvn13",
- # domain => "jabber.org",
- # password => "",
- # resource => "testingtest"
- #);
- my $JID = 'boyko_vn@jabber.ru';
- my $PASS = '';
- my $j = AnyEvent::->condvar;
- my $jClient = AnyEvent::XMPP::Client->new(debug=>1);
- my $disco = AnyEvent::XMPP::Ext::Disco->new;
- #my $version = AnyEvent::XMPP::Ext::Version->new;
- #$jClient->start;
- $jClient->add_extension($disco);
- #$jClient->add_extension($version);
- $jClient->set_presence(undef, "testingtest", 1);
- $jClient->add_account($JID, $PASS);
- warn "Connecting to $JID...\n";
- $jClient->reg_cb(
- session_ready => sub {
- my ($jClient, $account) = @_;
- warn "connected!\n";
- },
- disconnect => sub {
- warn "Got disconnected: [@_]\n";
- #$jClient->broadcast;
- },
- connected => sub {
- my ($jClient, $account) = @_;
- print "Connected... $account\n";
- },
- connect_error => sub {
- my ($jClient, $account, $error) = @_;
- die "ERROR! $error\n";
- },
- error => sub {
- my ($jClient, $account, $error) = @_;
- die "ERROR! $error\n";
- },
- added_account => sub {
- my ($jClient, $account) = @_;
- print "Account added...$account\n";
- },
- removed_account => sub {
- my ($jClient, $account) = @_;
- print "Account removed...$account\n";
- }
- );
- $jClient->start;
- $j->wait;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement