* liece-dcc.el (liece-dcc-start-process): New function.
authorueno <ueno>
Sun, 27 Jan 2002 16:47:09 +0000 (16:47 +0000)
committerueno <ueno>
Sun, 27 Jan 2002 16:47:09 +0000 (16:47 +0000)
(liece-command-dcc-send): Use it.
(liece-command-dcc-receive): Use it.
(liece-command-dcc-chat-listen): Use it.
(liece-command-dcc-chat-connect): Use it.

lisp/liece-dcc.el

index 4963610..ff384ba 100644 (file)
 
 (defstruct liece-dcc-object type from host port file size)
 
+(defun liece-dcc-start-process (args)
+  (let ((program
+        (or (car-safe liece-dcc-program)
+            liece-dcc-program)))
+    (apply #'start-process " *DCC*" nil program args)))
+
 (defun liece-dcc-enqueue-request (type &rest args)
   (let ((request (apply #'make-liece-dcc-object :type type args)))
     (inline (queue-enqueue liece-dcc-requests request))))
          nil nil nil nil liece-privmsg-partner)))
 
   (setq liece-privmsg-partner towhom)
-  (let (process)
-    (setq process (start-process
-                  liece-dcc-program nil liece-dcc-program
-                  "send" (int-to-string liece-dcc-port) filename))
+  (let ((process
+        (liece-dcc-start-process
+         (list "send" (int-to-string liece-dcc-port) filename))))
     (set-process-filter process #'liece-dcc-send-filter)
     (set-process-sentinel process #'liece-dcc-sentinel))
   (or (zerop liece-dcc-port)
             (expand-file-name
              (liece-dcc-object-file object)
              liece-dcc-directory))
-           process)
-       (setq process
-             (start-process
-              liece-dcc-program nil liece-dcc-program
-              "receive"
-              (liece-dcc-object-host object)
-              (liece-dcc-object-port object)
-              (liece-dcc-object-size object)
-              (expand-file-name
-               (liece-dcc-object-file object)
-               liece-dcc-directory)))
+           (process
+            (liece-dcc-start-process
+             (list "receive"
+                   (liece-dcc-object-host object)
+                   (liece-dcc-object-port object)
+                   (liece-dcc-object-size object)
+                   (expand-file-name
+                    (liece-dcc-object-file object)
+                    liece-dcc-directory)))))
        (set-process-filter process #'liece-dcc-receive-filter)
        (set-process-sentinel process  #'liece-dcc-sentinel)
        (liece-dcc-add-to-process-alist
          (append liece-nick-alist liece-channel-alist)
          nil nil nil nil liece-privmsg-partner)))
   (setq liece-privmsg-partner towhom)
-  (let (process)
-    (as-binary-process
-     (setq process
-          (start-process
-           liece-dcc-program nil
-           liece-dcc-program "chat" "listen"
-           (int-to-string liece-dcc-port)))
-     (set-process-buffer
-      process
-      (liece-get-buffer-create (format " DCC:%s" (process-id process))))
-     (set-process-filter process 'liece-dcc-chat-listen-filter)
-     (set-process-sentinel process 'liece-dcc-sentinel)))
+  (let ((process
+        (as-binary-process
+         (liece-dcc-start-process
+          (list "chat" "listen" (int-to-string liece-dcc-port))))))
+    (set-process-buffer
+     process
+     (liece-get-buffer-create (format " DCC:%s" (process-id process))))
+    (set-process-filter process 'liece-dcc-chat-listen-filter)
+    (set-process-sentinel process 'liece-dcc-sentinel))
   (unless (zerop liece-dcc-port)
     (setq liece-dcc-port (1+ liece-dcc-port))))
 
        (liece-message (_ "DCC No chat request has been arrived."))
       (liece-dcc-message (_ "Connecting to: %s") nick)
       (setq liece-privmsg-partner nick)
-      (as-binary-process
-       (setq process
-            (start-process liece-dcc-program nil
-                           liece-dcc-program "chat" "connect"
-                           (liece-dcc-object-host object)
-                           (liece-dcc-object-port object)))
-       (set-process-buffer
-       process
-       (liece-get-buffer-create
-        (format " DCC:%s" (process-id process))))
-       (set-process-filter process #'liece-dcc-chat-connect-filter)
-       (set-process-sentinel process #'liece-dcc-sentinel)
-       (liece-dcc-add-to-process-alist
-       process 'chat :from liece-privmsg-partner)))))
+      (setq process
+           (as-binary-process
+            (liece-dcc-start-process
+             (list "chat" "connect"
+                   (liece-dcc-object-host object)
+                   (liece-dcc-object-port object)))))
+      (set-process-buffer
+       process
+       (liece-get-buffer-create
+       (format " DCC:%s" (process-id process))))
+      (set-process-filter process #'liece-dcc-chat-connect-filter)
+      (set-process-sentinel process #'liece-dcc-sentinel)
+      (liece-dcc-add-to-process-alist
+       process 'chat :from liece-privmsg-partner))))
 
 (defun liece-dcc-chat-connect-filter (process output)
   (if (string-match "^DCC chat established" output)