2005-02-18 Steve Youngs <steve@sxemacs.org>
authorueno <ueno>
Sat, 19 Feb 2005 06:42:55 +0000 (06:42 +0000)
committerueno <ueno>
Sat, 19 Feb 2005 06:42:55 +0000 (06:42 +0000)
* riece-ctcp.el (riece-handle-ctcp-time-request): New.
(riece-handle-ctcp-time-response): New.
(riece-command-ctcp-time): New.
(riece-ctcp-enable): Add `riece-command-ctcp-time'.
(riece-ctcp-disable): Ditto.

* riece-layout.el (riece-layout-alist): Minor doc string fix --
escape a couple of parens.

* riece-version.el: defvar sxemacs-codename at compile time.
(riece-extended-version): Simplify the XEmacs section, add support
for SXEmacs.

lisp/ChangeLog
lisp/riece-ctcp.el
lisp/riece-layout.el
lisp/riece-version.el

index 7b7738c..dd78f3c 100644 (file)
@@ -1,3 +1,18 @@
+2005-02-18  Steve Youngs  <steve@sxemacs.org>
+
+       * riece-ctcp.el (riece-handle-ctcp-time-request): New.
+       (riece-handle-ctcp-time-response): New.
+       (riece-command-ctcp-time): New.
+       (riece-ctcp-enable): Add `riece-command-ctcp-time'.
+       (riece-ctcp-disable): Ditto.
+       
+       * riece-layout.el (riece-layout-alist): Minor doc string fix --
+       escape a couple of parens.
+       
+       * riece-version.el: defvar sxemacs-codename at compile time.
+       (riece-extended-version): Simplify the XEmacs section, add support
+       for SXEmacs.
+
 2005-02-17  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * riece-addon.el (riece-resolve-addons): Fixed
index 8c45869..d7ffe6b 100644 (file)
      (concat (riece-concat-server-name (concat riece-ctcp-action-prefix user
                                               " " string)) "\n"))))
 
+(defun riece-handle-ctcp-time-request (prefix target string)
+  (let* ((target-identity (riece-make-identity target riece-server-name))
+        (buffer (if (riece-channel-p target)
+                    (riece-channel-buffer target-identity)))
+        (user (riece-prefix-nickname prefix))
+        (time (format-time-string "%c")))
+    (riece-send-string
+     (format "NOTICE %s :\1TIME %s\1\r\n" user time))
+    (riece-insert-change buffer (format "CTCP TIME from %s\n" user))
+    (riece-insert-change
+     (if (and riece-channel-buffer-mode
+             (not (eq buffer riece-channel-buffer)))
+        (list riece-dialogue-buffer riece-others-buffer)
+       riece-dialogue-buffer)
+     (concat
+      (riece-concat-server-name
+       (format "CTCP TIME from %s (%s) to %s"
+              user
+              (riece-strip-user-at-host (riece-prefix-user-at-host prefix))
+              (riece-format-identity target-identity t)))
+      "\n"))))
+
 (defun riece-handle-ctcp-response (prefix string)
   (when (and riece-ctcp-enabled prefix string
             (riece-prefix-nickname prefix))
             string))
     "\n")))
 
+(defun riece-handle-ctcp-time-response (prefix target string)
+  (riece-insert-change
+   (list riece-dialogue-buffer riece-others-buffer)
+   (concat
+    (riece-concat-server-name
+     (format "CTCP TIME for %s (%s) = %s"
+            (riece-prefix-nickname prefix)
+            (riece-strip-user-at-host (riece-prefix-user-at-host prefix))
+            string))
+    "\n")))
+
 (defun riece-command-ctcp-version (target)
   (interactive
    (list (riece-completing-read-identity
                 " (in " (riece-format-identity target t) ")")))
       "\n"))))
 
+(defun riece-command-ctcp-time (target)
+  (interactive
+   (list (riece-completing-read-identity
+         "Channel/User: "
+         (riece-get-identities-on-server (riece-current-server-name)))))
+  (riece-send-string (format "PRIVMSG %s :\1TIME\1\r\n"
+                            (riece-identity-prefix target))))
+
 (defun riece-ctcp-requires ()
   (if (memq 'riece-highlight riece-addons)
       '(riece-highlight)))
   (define-key riece-dialogue-mode-map "\C-cp" 'riece-command-ctcp-ping)
   (define-key riece-dialogue-mode-map "\C-ca" 'riece-command-ctcp-action)
   (define-key riece-dialogue-mode-map "\C-cc" 'riece-command-ctcp-clientinfo)
+  (define-key riece-dialogue-mode-map "\C-ct" 'riece-command-ctcp-time)
   (setq riece-ctcp-enabled t))
 
 (defun riece-ctcp-disable ()
   (define-key riece-dialogue-mode-map "\C-cp" nil)
   (define-key riece-dialogue-mode-map "\C-ca" nil)
   (define-key riece-dialogue-mode-map "\C-cc" nil)
+  (define-key riece-dialogue-mode-map "\C-ct" nil)
   (setq riece-ctcp-enabled nil))
 
 (provide 'riece-ctcp)
index 08441e3..05bdabd 100644 (file)
@@ -49,8 +49,8 @@
   "An alist mapping the names to layout functions.
 An element of this alist is either in the following forms:
 
-(NAME CONFIGURE-FUNCTION [PARAMETERS])
-(NAME1 . NAME2)
+\(NAME CONFIGURE-FUNCTION [PARAMETERS]\)
+\(NAME1 . NAME2\)
 
 In the first form, NAME is a string which specifies the layout
 setting, and CONFIGURE-FUNCTION is a function which does window
index 84ff418..1e362c5 100644 (file)
@@ -55,7 +55,8 @@ string, be sure to use a valid format, see RFC 2616."
   "Version string for this version of Riece.")
 
 (eval-when-compile
-  (defvar xemacs-codename))
+  (defvar xemacs-codename)
+  (defvar sxemacs-codename))
 
 (defun riece-extended-version ()
   "Stringified Riece version and Emacs version.
@@ -79,22 +80,20 @@ See the variable `riece-user-agent'."
                    (if system-v
                        (concat " (" system-v ")")
                      "")))
-          ((string-match
-            "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
-            emacs-version)
-           (concat
-            (match-string 1 emacs-version)
-            (format "/%d.%d" emacs-major-version emacs-minor-version)
-            (if (match-beginning 3)
-                (match-string 3 emacs-version)
-              "")
-            (if (boundp 'xemacs-codename)
-                (concat
-                 " (" xemacs-codename
-                 (if system-v
-                     (concat ", " system-v ")")
-                   ")"))
-              "")))
+          ((featurep 'sxemacs)
+           (concat "SXEmacs/" emacs-program-version
+                   (when system-v
+                     (concat " ("
+                             (when sxemacs-codename
+                               (concat sxemacs-codename ", "))
+                             system-v ")"))))
+          ((featurep 'xemacs)
+           (concat "XEmacs/" emacs-program-version
+                   (when system-v
+                     (concat " ("
+                             (when xemacs-codename
+                               (concat xemacs-codename ", "))
+                             system-v ")"))))
           (t emacs-version))))
     (if (stringp riece-user-agent)
        riece-user-agent