Net-Chat-Daemon

 view release on metacpan or  search on metacpan

lib/Net/Chat/Daemon.pm  view on Meta::CPAN

    $_ = substr($_, 1, -1) if (/^['"]/);
  }

  # Add the attachments to the end of the @args array. This is most
  # likely an abuse of the Jabber protocol.
  my $attachments_node = $message->{TREE}->XPath("attachments");
  my @attachments = $attachments_node ? $attachments_node->children() : ();
  foreach my $node (@attachments) {
    my %attachment;
    foreach ($node->children()) {
      $attachment{$_->get_tag()} = $_->get_cdata();
    }
    push @args, \%attachment;
  }

  # Lookup the handler for this command and call it, then send back
  # the result as a reply.
  my $meth = $self->getHandler($cmd);
  my $reply = $message->Reply();
  local $self->{last_message} = $message;
  if ($meth) {

scripts/jabber  view on Meta::CPAN

  my $sid = shift;
  my $msg = shift;
  my $src = $msg->GetFrom("jid")->GetUserID();
  my $msgtxt = $msg->GetBody();
  print "GOT MESSAGE: $msgtxt\n";
  my $attachments = $msg->{TREE}->XPath("attachments");
  if ($attachments) {
    foreach my $node ($attachments->children()) {
      my %attachment;
      foreach ($node->children()) {
        $attachment{$_->get_tag()} = $_->get_cdata();
      }

      print "Attachment type: $attachment{type}\n";
      local $_ = $attachment{data};
      s/^/= /g;
      print;
      print "\n";
    }
  }
  $Con->MessageSend(to=>$msg->GetFrom(), subject=>"Build of $msgtxt",



( run in 0.747 second using v1.01-cache-2.11-cpan-454fe037f31 )