daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Aug 12th, 2013 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. use Purple;
  3. use strict;
  4.  
  5. our %PLUGIN_INFO = (
  6.  perl_api_version => 2,
  7.  name => 'exted',
  8.  version => '0.1',
  9.  summary => 'external editor',
  10.  description => 'external editor',
  11.  author => 'Dmitry Sukhodoyev <raven428@gmail.com>',
  12.  url => 'http://pidgin.im',
  13.  load => 'plugin_load',
  14. );
  15.  
  16. sub plugin_init {
  17.  return %PLUGIN_INFO;
  18. }
  19.  
  20. sub exted {
  21.  my($conv, $cmd, $data, @args) = @_;
  22.  my $filename = `/usr/bin/mktemp -t exted`;
  23.  system("$ENV{EDITOR} $filename");
  24.  my $text = `/bin/cat $filename`;
  25.  unlink($filename);
  26.  $text =~ s/[\n\r]+$//;
  27.  $conv->do_command("say $text", '', 0);
  28.  return Purple::Cmd::Return::OK;
  29. }
  30.  
  31. sub plugin_load {
  32.  my $plugin = shift;
  33.  Purple::Cmd::register(
  34.   $plugin,
  35.   'exted',
  36.   'ws',
  37.   Purple::Cmd::Priority::DEFAULT,
  38.   Purple::Cmd::Flag::IM |
  39.   Purple::Cmd::Flag::CHAT |
  40.   Purple::Cmd::Flag::ALLOW_WRONG_ARGS,
  41.   0,
  42.   \&exted,
  43.   'run $EDITOR to edit message',
  44.   $plugin
  45.  );
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top