* riece-options.el (riece-channel-history-length): New user option.
[riece] / lisp / riece-server.el
index d750824..25d67a4 100644 (file)
@@ -27,6 +27,8 @@
 (require 'riece-options)
 (require 'riece-globals)               ;for server local variables.
 (require 'riece-coding)                        ;riece-default-coding-system
+(require 'riece-identity)
+(require 'riece-compat)
 
 (eval-and-compile
   (defvar riece-server-keyword-map
@@ -60,22 +62,6 @@ the `riece-server-keyword-map' variable."
 (put 'riece-server-keyword-bind 'lisp-indent-function 1)
 (put 'riece-server-keyword-bind 'edebug-form-spec '(form body))
 
-(defun riece-clear-system ()
-  (while riece-buffer-list
-    (if (and (get-buffer (car riece-buffer-list))
-            (buffer-live-p (car riece-buffer-list)))
-       (funcall riece-buffer-dispose-function (car riece-buffer-list)))
-    (setq riece-buffer-list (cdr riece-buffer-list)))
-  (setq riece-current-channels nil
-       riece-current-channel nil
-       riece-user-indicator nil
-       riece-channel-indicator "None"
-       riece-channel-list-indicator "No channel"
-       riece-away-indicator "-"
-       riece-operator-indicator "-"
-       riece-freeze-indicator "-")
-  (delete-other-windows))
-
 (defun riece-server-parse-string (string)
   "Convert a STRING set as `riece-server' and return a property list."
   (when (or (string-match "^\\[\\([^]]+\\)\\]:?\\([0-9]*\\)" string)
@@ -217,6 +203,17 @@ the `riece-server-keyword-map' variable."
            (throw 'found t))
        (setq process-list (cdr process-list))))))
 
+(defun riece-quit-server-process (process &optional message)
+  (run-at-time riece-quit-timeout nil
+              (lambda (process)
+                (if (memq process riece-process-list)
+                    (kill-process (process-buffer process))))
+              process)
+  (riece-process-send-string process
+                            (if message
+                                (format "QUIT :%s\r\n" message)
+                              "QUIT\r\n")))
+
 (provide 'riece-server)
 
 ;;; riece-server.el ends here