2006年8月14日

Plagger::Plugin::Notify::Jabber へ向けての第一歩。とりあえず、Net::Jabber で接続して切断するだけのところまで動いたっぽい。

#!/usr/bin/perl

use strict;
use warnings;
use Net::Jabber qw(Client);

my $client = Net::Jabber::Client->new(
    debuglevel => 1,
    debugfile  => "debug.log",
) or die "can't create Net::XMPP::Client instance.";

my $ok = $client->Connect(
    hostname => q{jabber.org},
    username => q{ziguzagu-bot},
    passowrd => q{******},
) or die "cant't connect jabber server.";

$client->Disconnect();

で、debug.log にたらたらログが、

XML::Stream: new: hostname = (colinux)
XML::Stream: SetCallBacks: tag(node) func(CODE(0x8adb360))
XMPP::Conn: SetCallBacks: tag(message) func(CODE(0x8adb51c))
XMPP::Conn: SetCallBacks: tag(presence) func(CODE(0x8adb4bc))
XMPP::Conn: SetCallBacks: tag(iq) func(CODE(0x8adb45c))
XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp
-tls"]) func(CODE(0x8192bec))
XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp
-sasl"]) func(CODE(0x8192d30))
XMPP::Conn: Connect: host(jabber.org:5222) namespace(jabber:client)
XMPP::Conn: Connect: timeout(10)
XML::Stream: Connect: type(tcpip)
XML::Stream: Connect: Got a connection
XML::Stream: Send: (<?xml version='1.0'?><stream:stream version='1.0' xmlns:stre
am='http://etherx.jabber.org/streams' xmlns='jabber:client' to='jabber.org' from
='colinux' xml:lang='en' >)
XML::Stream: Read: buff(<?xml version='1.0'?><stream:stream xmlns='jabber:client
' xmlns:stream='http://etherx.jabber.org/streams' id='1288182596' from='jabber.o
rg' version='1.0' xml:lang='en'>)
XML::Stream: Read: buff(<stream:features><starttls xmlns='urn:ietf:params:xml:ns
:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGE
ST-MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms><register xmlns='http
://jabber.org/features/iq-register'/></stream:features>)
XMPP::Conn: Connect: connection made
XML::Stream: SetCallBacks: tag(node) func(CODE(0x8194ad0))
XML::Stream: Send: (</stream:stream>)
XML::Stream: SetCallBacks: tag(node) func(CODE(0x8afe410))
XMPP::Conn: Disconnect: bye bye

きた。接続できたくさい…。

あとは、メッセージ送るところか…。あ、肝心要の Plagger のプラグインの作り方も。

Comments

トラックバック

トラックバックURL: