notes, for the record
[scpubgit/Clifton.git] / notes / xmppnotes
diff --git a/notes/xmppnotes b/notes/xmppnotes
new file mode 100644 (file)
index 0000000..62875c3
--- /dev/null
@@ -0,0 +1,15 @@
+use Net::Async::XMPP::Client
+my $xmpp = Net::Async::XMPP::Client->new
+$_SERVER->add_child($xmpp);
+$xmpp->login(jid => 'dexter@sevvie.co', host => 'corvina.org', password => "2smvjCsn");
+$xmpp->compose(to => 'mst@corvina.org', body => 'hi')->send
+$xmpp->configure(on_message => sub { print STDERR $_[1]->body."\n" });
+
+re.pl$ use Net::Async::IRC;
+re.pl$ $_SERVER->add_child(my $irc = Net::Async::IRC->new);
+ $irc->login(nick => 'clifton_mst', host => 'irc.perl.org', on_login => sub { print STDERR "login\n" });
+$irc->send_message("JOIN", undef, '#hearts');
+
+$xmpp->configure(on_message => sub { if ($_[1]->to eq 'dexter@sevvie.co'){ $irc->send_message("PRIVMSG", undef, '#hearts', $_[1]->body) } });
+
+$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 } });