1 ;;; riece-rdcc.el --- ruby implementation of DCC add-on
2 ;; Copyright (C) 1998-2003 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Keywords: IRC, riece
7 ;; This file is part of Riece.
9 ;; This program is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
26 (require 'riece-globals)
28 (require 'riece-channel)
29 (require 'riece-identity)
30 (require 'riece-ctcp) ;for riece-ctcp-additional-clientinfo
32 (defgroup riece-rdcc nil
33 "DCC implementation using ruby"
37 (defcustom riece-rdcc-server-address nil
38 "Local address of the DCC server.
39 Only used for sending files."
43 (defcustom riece-rdcc-ruby-command "ruby"
44 "Command name for Ruby interpreter."
48 (defcustom riece-rdcc-send-program
53 sock.connect('164.46.176.4', 7) # www.unixuser.org/echo
54 address = sock.getsockname[4 .. 7].unpack('CCCC').join('.')
56 server = TCPServer.new(address, 0)
57 puts(\"#{server.addr[3].split(/\\./).collect{|c| c.to_i}.pack('CCCC').unpack('N')[0]} #{server.addr[1]}\")
58 session = server.accept
61 File.open(" file ") {|file|
62 while (bytes = file.read(4096))
71 "Ruby program to send file with DCC."
75 (defcustom riece-rdcc-decode-address-program
77 puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
78 address " >> 8 & 0xFF}.#{" address " & 0xFF}\")")
79 "Ruby program to numeric IP address."
83 (defvar riece-rdcc-requests nil)
85 (defvar riece-rdcc-request-user nil)
86 (defvar riece-rdcc-request-file nil)
87 (defvar riece-rdcc-request-size nil)
89 (defvar jka-compr-compression-info-list)
90 (defvar jam-zcat-filename-list)
91 (defun riece-rdcc-substitute-variables (program variable value)
92 (setq program (copy-sequence program))
93 (let ((pointer program))
95 (setq pointer (memq variable program))