From: ueno Date: Mon, 16 Apr 2007 03:21:21 +0000 (+0000) Subject: * riece-rdcc.el (riece-rdcc-server-address): Accept a cons cell to X-Git-Tag: riece-4_0_0~17 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=52ff8cff0ff403a324b2b1b8340f75d6dc468808;p=elisp%2Friece.git * 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 304927a..0bbd3a3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2007-04-16 Daiki Ueno + + * 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 * riece-handle.el (riece-handle-notice-message): Don't check the diff --git a/lisp/riece-rdcc.el b/lisp/riece-rdcc.el index 9b5286f..7c0d86d 100644 --- a/lisp/riece-rdcc.el +++ b/lisp/riece-rdcc.el @@ -43,19 +43,21 @@ (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