notes, for the record
[scpubgit/Clifton.git] / notes / xmppnotes
CommitLineData
06185cf5 1use Net::Async::XMPP::Client
2my $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
8re.pl$ use Net::Async::IRC;
9re.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 } });