notes, for the record
[scpubgit/Clifton.git] / notes / xmppnotes
1 use Net::Async::XMPP::Client
2 my $xmpp = Net::Async::XMPP::Client->new
3 $_SERVER->add_child($xmpp);
4 $xmpp->login(jid => 'dexter@sevvie.co', host => 'corvina.org', password => "2smvjCsn");
5 $xmpp->compose(to => 'mst@corvina.org', body => 'hi')->send
6 $xmpp->configure(on_message => sub { print STDERR $_[1]->body."\n" });
7
8 re.pl$ use Net::Async::IRC;
9 re.pl$ $_SERVER->add_child(my $irc = Net::Async::IRC->new);
10  $irc->login(nick => 'clifton_mst', host => 'irc.perl.org', on_login => sub { print STDERR "login\n" });
11 $irc->send_message("JOIN", undef, '#hearts');
12
13 $xmpp->configure(on_message => sub { if ($_[1]->to eq 'dexter@sevvie.co'){ $irc->send_message("PRIVMSG", undef, '#hearts', $_[1]->body) } });
14
15 $irc->configure(on_message_text => sub { my $h = $_[2]; if (!$h->{prefix_is_me} && $h->{target_name} eq '#hearts') { $xmpp->compose(to => 'mst@corvina.org', body => join(': ', $h->{prefix_name}, $h->{text}))->send } });