Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
As a sequal on my previous CUFP, here's a way to reply to private messages... this chunk is ofcourse based on lhoward's node too... (no XML this time, sorry OeufMayo :) )
Update: Tweaked some Monestary related things... Thanks epoptai
#!/usr/bin/perl use LWP::UserAgent; use URI::URL; use HTTP::Cookies; IRC::register("Monk Messenger", "0.1", "", ""); IRC::print "\0035:: Loading Monk Messenger ::\003\n"; IRC::add_command_handler("msgmonk", "msg_monk"); sub msg_monk { my $message = @_[0]; $message = substr($message,0,255); ($user,$message) = split(/ /,$message,2); my $pm_user=''; # Monk alias my $pm_password=''; # Monk password my $WWWAgent = new LWP::UserAgent(); my $co=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1,ignore_ +discard=>1); $WWWAgent->cookie_jar($co); my $url=new URI::URL 'http://www.perlmonks.org/index.pl'; $url->query_form(op => "login",node_id => "16046",user => $pm_user +,passwd => $pm_password,expires=> "+10y"); my $WWWRequest = new HTTP::Request 'GET', $url->as_string() ; my $WWWResult = $WWWAgent->request($WWWRequest); die "Error logging in $WWWResult->code $WWWResult->message" if(!$W +WWResult->is_success); $url=new URI::URL 'http://www.perlmonks.org/index.pl'; $url->query_form(op => 'message',node=>"16046", message=>"/msg $us +er $message"); $WWWRequest = new HTTP::Request 'GET', $url->as_string() ; $WWWResult = $WWWAgent->request($WWWRequest); die "Can't load Monk Messanger $WWWResult->code $WWWResult->messag +e" if(!$WWWResult->is_success); IRC::print "you said $message to $user\n"; 1; }
You can put this in your .xchat directory to get automatically loaded on startup...
How this works : /msgmonk <monk> <message> ,like in CB... (Something like "/msgmonk Beatnik hey dude your code sucks" will ofcourse work :-|)

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

In reply to Send private CB messages through XChat by Beatnik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (16)
    As of 2014-10-24 16:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (133 votes), past polls