Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Cbstream: a chatterbox to irc bridge(irssi client)

by shmem (Chancellor)
on Jan 22, 2007 at 13:20 UTC ( [id://595908]=note: print w/replies, xml ) Need Help??


in reply to Cbstream: a chatterbox to irc bridge

And here's a client to be used from within irssi...
# (c) shmem use Irssi qw(command_bind); use strict; use vars qw($VERSION %IRSSI); use LWP::UserAgent; use HTTP::Cookies; $VERSION = '0.0.2'; %IRSSI = ( 'authors' => 'shmem', 'contact' => 'gm@@ccrruufftt..ddee', 'name' => 'pm cbtalk', 'description' => 'talks to te perlmonks chatterbox', 'license' => 'Artistic', 'url' => 'http://perlmonks.org/?node_id=595908', 'changed' => '2007-01-27', ); my $pmchat = 'http://perlmonks.org/?'; my $ua = LWP::UserAgent->new; $ua->cookie_jar( HTTP::Cookies->new( file => "pmcookie.txt", autosave => 1, ) ); $ua->agent("cbtalk/0.0 [shmem]"); sub login { my ($msg, undef, $channel) = @_; my ($user,$password) = split /\s+/, $msg; my $req = HTTP::Request->new(POST => $pmchat); $req->content("displaytype=raw&node_id=109&op=login&node_id=109&us +er=$user&passwd=$password&sexisgood=submit"); $ua->request($req); } sub cbtalk { my ($msg, undef, $channel) = @_; $msg =~ s/\W/sprintf"%%%02x",ord$&/ge; my $req = HTTP::Request->new(POST => $pmchat); $req->content_type('application/x-www-form-urlencoded'); $req->content("displaytype=raw&node_id=3193&op=message&message=$ms +g&message_send=talk"); $ua->request($req); } command_bind('cb', 'cbtalk'); command_bind('cblogin','login');

...which allows you to POST to the chatterbox while in #cbstream:

/script load cbtalk.pl /cblogin shmem ******** /cb [ambrus]++, your cbstream thingy rocks! :-)

enjoy,

--shmem

update: post #666 - storing usernames and plaintext passwords in a script is eeevil at it's best! :-P

update2:added command to set credentials

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://595908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found