Translate.
[elisp/riece.git] / lisp / riece-commands.el
index 7bcbfa5..5241a68 100644 (file)
@@ -19,8 +19,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
 
@@ -32,6 +32,7 @@
 (require 'riece-misc)
 (require 'riece-identity)
 (require 'riece-message)
+(require 'riece-mcat)
 
 (autoload 'derived-mode-class "derived")
 
@@ -194,7 +195,8 @@ the layout to the selected layout-name."
                                0)))))
   (riece-send-string (format "TOPIC %s :%s\r\n"
                             (riece-identity-prefix riece-current-channel)
-                            topic)))
+                            topic)
+                    riece-current-channel))
 
 (defun riece-command-invite (user)
   (interactive
@@ -204,7 +206,7 @@ the layout to the selected layout-name."
            "Invite user: "
            (riece-get-users-on-server (riece-current-server-name))
            nil nil nil nil nil t))))
-  (riece-send-string (format "INVITE %s %s\r\n"
+  (riece-send-string (format "INVITE %s :%s\r\n"
                             (riece-identity-prefix user)
                             (riece-identity-prefix riece-current-channel))))
 
@@ -227,7 +229,8 @@ the layout to the selected layout-name."
               user message)
      (format "KICK %s %s\r\n"
             (riece-identity-prefix riece-current-channel)
-            user))))
+            user))
+   riece-current-channel))
 
 (defun riece-command-names (pattern)
   (interactive
@@ -385,14 +388,16 @@ the layout to the selected layout-name."
        (riece-send-string
         (format "NOTICE %s :%s\r\n"
                 (riece-identity-prefix riece-current-channel)
-                message))
+                message)
+        riece-current-channel)
        (riece-display-message
         (riece-make-message (riece-current-nickname) riece-current-channel
                             message 'notice t)))
     (riece-send-string
      (format "PRIVMSG %s :%s\r\n"
             (riece-identity-prefix riece-current-channel)
-            message))
+            message)
+     riece-current-channel)
     (riece-display-message
      (riece-make-message (riece-current-nickname) riece-current-channel
                         message nil t))))
@@ -431,24 +436,24 @@ the layout to the selected layout-name."
               (riece-line-beginning-position)
               (riece-line-end-position))))
     (riece-send-string
-     (format "PRIVMSG %s :%s\r\n" (riece-identity-prefix user) text))
+     (format "PRIVMSG %s :%s\r\n" (riece-identity-prefix user) text)
+     user)
     (riece-display-message
      (riece-make-message (riece-current-nickname) user text nil t)))
   (let ((next-line-add-newlines t))
     (next-line 1)))
 
 (defun riece-command-join-channel (target key)
-  (let ((process (riece-server-process (riece-identity-server target))))
-    (unless process
-      (error "%s" (substitute-command-keys
-                  "Type \\[riece-command-open-server] to open server.")))
-    (riece-process-send-string process
-                              (if key
-                                  (format "JOIN %s :%s\r\n"
-                                          (riece-identity-prefix target)
-                                          key)
-                                (format "JOIN %s\r\n"
-                                        (riece-identity-prefix target))))))
+  (unless (riece-server-opened (riece-identity-server target))
+    (error "%s" (substitute-command-keys
+                "Type \\[riece-command-open-server] to open server.")))
+  (riece-send-string (if key
+                        (format "JOIN %s :%s\r\n"
+                                (riece-identity-prefix target)
+                                key)
+                      (format "JOIN %s\r\n"
+                              (riece-identity-prefix target)))
+                    target))
 
 (defun riece-command-join-partner (target)
   (let ((pointer (riece-identity-member target riece-current-channels)))
@@ -479,14 +484,16 @@ the layout to the selected layout-name."
        (riece-command-join-partner target)))))
 
 (defun riece-command-part-channel (target message)
-  (let ((process (riece-server-process (riece-identity-server target))))
-    (riece-process-send-string process
-                              (if message
-                                  (format "PART %s :%s\r\n"
-                                          (riece-identity-prefix target)
-                                          message)
-                                (format "PART %s\r\n"
-                                        (riece-identity-prefix target))))))
+  (unless (riece-server-opened (riece-identity-server target))
+    (error "%s" (substitute-command-keys
+                "Type \\[riece-command-open-server] to open server.")))
+  (riece-send-string (if message
+                        (format "PART %s :%s\r\n"
+                                (riece-identity-prefix target)
+                                message)
+                      (format "PART %s\r\n"
+                              (riece-identity-prefix target)))
+                    target))
 
 (defun riece-command-part (target &optional message)
   (interactive
@@ -627,7 +634,7 @@ If prefix argument ARG is non-nil, toggle frozen status."
       (progn
        (message "No server process")
        (ding))
-    (if (y-or-n-p "Really quit IRC? ")
+    (if (y-or-n-p (riece-mcat "Really quit IRC? "))
        (let ((message
               (if arg
                   (read-string "Message: ")
@@ -714,7 +721,10 @@ If prefix argument ARG is non-nil, toggle frozen status."
         (if current-prefix-arg
             (read-string "Message: ")
           riece-quit-message)))
-  (riece-quit-server-process (riece-server-process server-name) message))
+  (let ((process (riece-server-process server-name)))
+    (unless process
+      (error "%s is not opened" server-name))
+    (riece-quit-server-process process message)))
 
 (defun riece-command-universal-server-name-argument ()
   (interactive)
@@ -727,6 +737,15 @@ If prefix argument ARG is non-nil, toggle frozen status."
     (message "")
     (call-interactively command)))
 
+(eval-when-compile
+  (autoload 'riece-save-variables-files "riece"))
+(defun riece-command-save-variables ()
+  "Save `riece-variables-file'."
+  (interactive)
+  (if (or riece-save-variables-are-dirty
+         (y-or-n-p "No changes made.  Save anyway? "))
+      (riece-save-variables-files)))
+
 (provide 'riece-commands)
 
 ;;; riece-commands.el ends here