From: Matt S Trout Date: Tue, 25 Jan 2011 03:58:32 +0000 (+0000) Subject: notes, for the record X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FClifton.git;a=commitdiff_plain;h=06185cf5ccc6d8e40da2853a8783643ed278cd8f notes, for the record --- diff --git a/notes/jsetup b/notes/jsetup new file mode 100644 index 0000000..cc524a3 --- /dev/null +++ b/notes/jsetup @@ -0,0 +1,5 @@ +use App::Clifton::Tower::Jabber +my $j = $_SERVER->_new_child('App::Clifton::Tower::Jabber', { server => $_SERVER, bridge_name => 'hearts', jabber_config => $_SERVER->current_config->bridges->get({ name => 'hearts' })->jabber }); +my $xmpp = $j->xmpp_client; +$xmpp->compose(to => 'mst@corvina.org', body => 'hi')->send +$xmpp->configure(on_message => $j->_replace_weakself('handle_message')); diff --git a/notes/xmppnotes b/notes/xmppnotes new file mode 100644 index 0000000..62875c3 --- /dev/null +++ b/notes/xmppnotes @@ -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 } });