[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erc-commit] [commit][master] erc-dcc: Make it possible to have separate
From: |
mwolson |
Subject: |
[Erc-commit] [commit][master] erc-dcc: Make it possible to have separate listen and public hosts. |
Date: |
Fri, 18 Jan 2008 03:20:04 -0500 |
commit 71de6b09b44565a4730f251fb44cdc84eb81d863
Author: Michael W. Olson <address@hidden>
Date: Fri Jan 18 03:12:01 2008 -0500
erc-dcc: Make it possible to have separate listen and public hosts.
diff --git a/ChangeLog b/ChangeLog
index 561a733..6ea1d66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,12 @@
without storing the whole thing in memory.
(erc-dcc-get-sentinel): Flush any remaining contents before
closing. No need to save buffer.
+ (erc-dcc-listen-host): New option that determines which IP address
+ to listen on.
+ (erc-dcc-public-host): New option that determines which IP address
+ to advertise when sending a file. This is useful for people who
+ are on a local subnet. Together, these two options replace
+ erc-dcc-host.
* erc.el (erc-mode-line-format): Add %N and %S. %N is the name of
the network, and %S is much like %s but with the network name
diff --git a/erc-dcc.el b/erc-dcc.el
index c9cec1d..243d09a 100644
--- a/erc-dcc.el
+++ b/erc-dcc.el
@@ -258,15 +258,24 @@ The result is also a string."
;;; Server code
-(defcustom erc-dcc-host nil
- "*IP address to use for outgoing DCC offers.
-Should be set to a string or nil, if nil, automatic detection of the
-host interface to use will be attempted."
+(defcustom erc-dcc-listen-host nil
+ "IP address to listen on when offering files.
+Should be set to a string or nil. If nil, automatic detection of
+the host interface to use will be attempted."
:group 'erc-dcc
:type (list 'choice (list 'const :tag "Auto-detect" nil)
(list 'string :tag "IP-address"
:valid-regexp erc-dcc-ipv4-regexp)))
+(defcustom erc-dcc-public-host nil
+ "IP address to use for outgoing DCC offers.
+Should be set to a string or nil. If nil, use the value of
+`erc-dcc-listen-host'."
+ :group 'erc-dcc
+ :type (list 'choice (list 'const :tag "Same as erc-dcc-listen-host" nil)
+ (list 'string :tag "IP-address"
+ :valid-regexp erc-dcc-ipv4-regexp)))
+
(defcustom erc-dcc-send-request 'ask
"*How to treat incoming DCC Send requests.
'ask - Report the Send request, and wait for the user to manually accept it
@@ -284,7 +293,7 @@ host interface to use will be attempted."
"Determine the IP address we are using.
If variable `erc-dcc-host' is non-nil, use it. Otherwise call
`erc-dcc-get-host' on the erc-server-process."
- (or erc-dcc-host (erc-dcc-get-host erc-server-process)
+ (or erc-dcc-listen-host (erc-dcc-get-host erc-server-process)
(error "Unable to determine local address")))
(defcustom erc-dcc-port-range nil
@@ -819,7 +828,8 @@ other client."
(process-send-string
pproc (format "PRIVMSG %s :\C-aDCC SEND %s %s %d %d\C-a\n"
nick (erc-dcc-file-to-name file)
- (erc-ip-to-decimal (nth 0 contact))
+ (erc-ip-to-decimal (or erc-dcc-public-host
+ (nth 0 contact)))
(nth 1 contact)
size)))
(error "`make-network-process' not supported by your Emacs")))
@@ -927,15 +937,15 @@ transfer is complete."
;; FIXME, we should look at EVENT, and also check size.
(with-current-buffer (process-buffer proc)
(delete-process proc)
- (setq buffer-read-only nil)
(setq erc-dcc-list (delete erc-dcc-entry-data erc-dcc-list))
(unless (= (point-min) (point-max))
+ (setq erc-dcc-byte-count (+ (buffer-size) erc-dcc-byte-count))
(erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
(erc-display-message
nil 'notice erc-server-process
'dcc-get-complete
?f erc-dcc-file-name
- ?s (number-to-string (buffer-size))
+ ?s (number-to-string erc-dcc-byte-count)
?t (format "%.0f"
(erc-time-diff (plist-get erc-dcc-entry-data :start-time)
(erc-current-time)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Erc-commit] [commit][master] erc-dcc: Make it possible to have separate listen and public hosts.,
mwolson <=