* riece-rdcc.el (riece-rdcc-server-address): Accept a cons cell to
authorueno <ueno>
Mon, 16 Apr 2007 03:21:21 +0000 (03:21 +0000)
committerueno <ueno>
Mon, 16 Apr 2007 03:21:21 +0000 (03:21 +0000)
specify the sending port.
(riece-rdcc-send-program): Bind `port'.
(riece-command-dcc-send): Extract port from riece-rdcc-server-address.

lisp/ChangeLog
lisp/riece-rdcc.el

index 304927a..0bbd3a3 100644 (file)
@@ -1,3 +1,10 @@
+2007-04-16  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-rdcc.el (riece-rdcc-server-address): Accept a cons cell to
+       specify the sending port.
+       (riece-rdcc-send-program): Bind `port'.
+       (riece-command-dcc-send): Extract port from riece-rdcc-server-address.
+
 2007-02-12  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-handle.el (riece-handle-notice-message): Don't check the
index 9b5286f..7c0d86d 100644 (file)
 (defcustom riece-rdcc-server-address nil
   "Local address of the DCC server.
 Only used for sending files."
-  :type 'string
+  :type '(choice (string :tag "Address")
+                (cons (string :tag "Address") (integer :tag "Port")))
   :group 'riece-rdcc)
 
 (defcustom riece-rdcc-send-program
   '("\
 require 'socket'
 address = " address "
+port = " port "
 unless address
   sock = UDPSocket.new
   sock.connect('164.46.176.4', 7)              # www.unixuser.org/echo
   address = sock.getsockname[4 .. 7].unpack('CCCC').join('.')
 end
-server = TCPServer.new(address, 0)
+server = TCPServer.new(address, port)
 output(\"#{server.addr[3].split(/\\./).collect{|c| c.to_i}.pack('CCCC').unpack('N')[0]} #{server.addr[1]}\")
 session = server.accept
 if session
@@ -146,9 +148,18 @@ end
                riece-rdcc-send-program
                (list (cons 'address
                            (if riece-rdcc-server-address
-                               (concat "'" riece-rdcc-server-address
-                                       "'")
+                               (if (consp riece-rdcc-server-address)
+                                   (concat "'" (car riece-rdcc-server-address)
+                                           "'")
+                                 (concat "'" riece-rdcc-server-address
+                                         "'"))
                              "nil"))
+                     (cons 'port
+                           (if (and riece-rdcc-server-address
+                                    (consp riece-rdcc-server-address))
+                               (number-to-string
+                                (cdr riece-rdcc-server-address))
+                             "0"))
                      (cons 'file
                            (concat "'" file "'"))
                      (cons 'block-size