Source

eicq / eicq-toolbar.el

Diff from to

eicq-toolbar.el

-;; eicq-toolbar.el   -*-Emacs-Lisp-*-
-;; $Id$
-;; Copyright (C) 2000 Steve Youngs
+;;; eicq-toolbar.el --- A toolbar for Eicq   -*-Emacs-Lisp-*-
 
+;; Copyright (C) 2000, 2001 Steve Youngs
 
+;; RCS: $Id$
 ;; Author: Steve Youngs <youngs@xemacs.org>
-;;
+;; Maintainer: Steve Youngs <youngs@xemacs.org>
+;; Last-Modified: <2001-6-5 21:56:16 (steve)>
 ;; Keywords: eicq, toolbar, comm
 
-;; This file is part of XEmacs.
-
-;; XEmacs is free software; you can redistribute it and/or modify it
+;; Eicq is free software; you can redistribute it and/or modify it
 ;; under the terms of the GNU General Public License as published by the
 ;; Free Software Foundation; either version 2, or (at your option) any
 ;; later version.
 
-;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
+;; Eicq is distributed in the hope that it will be useful, but WITHOUT
 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 ;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 ;; for more details.
 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
-;; Commentary:
+;;; Commentary:
+;; 
+;;            A toolbar for eicq.
+;;
+(require 'eicq)
 
-;;            A toolbar for eicq
-
-;; Set some variables for the icon directory and files
-(eval-when-compile
-  (require 'eicq))
-
-(defvar eicq-icon-directory 
-  "/usr/local/lib/xemacs/xemacs-packages/etc/eicq/"
-  "The directory where the icon data files for eicq are installed.")
-
-(defvar eicq-password-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "password.xpm" eicq-icon-directory))
-  "A password toolbar icon.")
-
-(defvar eicq-show-log-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "show.xpm" eicq-icon-directory))
-  "A show-window toolbar icon.")
-
-(defvar eicq-hide-log-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "hide.xpm" eicq-icon-directory))
-  "A hide log toolbar icon.")
-
-(defvar eicq-send-message-here-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "send-message-here.xpm" eicq-icon-directory))
-  "A send message toolbar icon.")
-
-(defvar eicq-send-message-around-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "send-message-around.xpm" eicq-icon-directory))
-  "A send message toolbar icon.")
-
-(defvar eicq-send-url-here-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "url-here.xpm" eicq-icon-directory))
-  "A send URL toolbar icon.")
-
-(defvar eicq-send-url-around-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "url-around.xpm" eicq-icon-directory))
-  "A send URL toolbar icon.")
-
-(defvar eicq-query-info-here-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "query-here.xpm" eicq-icon-directory))
-  "A query info here toolbar icon.")
-
-(defvar eicq-query-info-around-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "query-around.xpm" eicq-icon-directory))
-  "A query info here toolbar icon.")
-
-(defvar eicq-update-info-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "update-info.xpm" eicq-icon-directory))
-  "A update info toolbar icon.")
-
-(defvar eicq-search-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "search.xpm" eicq-icon-directory))
-  "A search toolbar icon.")
-
-(defvar eicq-authorize-here-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "authorize-here.xpm" eicq-icon-directory))
-  "A authorize toolbar icon.")
-
-(defvar eicq-authorize-around-icon 
-  (toolbar-make-button-list 
-   (expand-file-name "authorize-around.xpm" eicq-icon-directory))
-  "A authorize toolbar icon.")
-
-(defvar eicq-login-icon
-  (toolbar-make-button-list
-   (expand-file-name "login.xpm" eicq-icon-directory))
-  "A login toolbar icon")
-
-(defvar eicq-logout-icon
-  (toolbar-make-button-list
-   (expand-file-name "logout.xpm" eicq-icon-directory))
-  "A logout toolbar icon")
-
-(defvar eicq-disconnect-icon
-  (toolbar-make-button-list
-   (expand-file-name "disconnect.xpm" eicq-icon-directory))
-  "A disconnect toolbar icon")
-
-(defvar eicq-mark-log-read-icon
-  (toolbar-make-button-list
-   (expand-file-name "read.xpm" eicq-icon-directory))
-  "Mark log read toolbar icon")
-
-(defvar eicq-mark-log-unread-icon
-  (toolbar-make-button-list
-   (expand-file-name "unread.xpm" eicq-icon-directory))
-  "Mark log unread toolbar icon")
-
-(defvar eicq-next-log-icon
-  (toolbar-make-button-list
-   (expand-file-name "next.xpm" eicq-icon-directory))
-  "Next log item toolbar icon")
-
-(defvar eicq-previous-log-icon
-  (toolbar-make-button-list
-   (expand-file-name "previous.xpm" eicq-icon-directory))
-  "Previous log item toolbar icon")
-
-(defvar eicq-new-log-icon
-  (toolbar-make-button-list
-   (expand-file-name "new-log.xpm" eicq-icon-directory))
-  "New log file toolbar icon")
-
-(defvar eicq-contract-log-icon
-  (toolbar-make-button-list
-   (expand-file-name "contract.xpm" eicq-icon-directory))
-  "Contract the log toolbar icon")
-
-(defvar eicq-expand-log-icon
-  (toolbar-make-button-list
-   (expand-file-name "expand.xpm" eicq-icon-directory))
-  "Expand the log toolbar icon")
-
-;; Define the functions for the toolbar
-
-(defun eicq-toolbar-change-password (password)
-  "Change password from the toolbar."
-  (interactive (list (read-passwd "Password: " 'confirm)))
-  (eicq-change-password password))
-
-(defun eicq-toolbar-show-log ()
-  "Show the log window from the toolbar"
-  (interactive)
-  (eicq-show-window))
-
-(defun eicq-toolbar-hide-log ()
-  "Hide the log window from the toolbar"
-  (interactive)
-  (eicq-hide-window))
-
-(defun eicq-toolbar-send-message-here ()
-  "Send message from toolbar"
-  (interactive)
-  (eicq-send-message-alias-here))
-
-(defun eicq-toolbar-send-message-around ()
-  "Send message from toolbar"
-  (interactive)
-  (eicq-send-message))
-
-(defun eicq-toolbar-send-url-here ()
-  "Send URL from the toolbar"
-  (interactive)
-  (eicq-send-url-alias-here))
-
-(defun eicq-toolbar-send-url-around ()
-  "Send URL from the toolbar"
-  (interactive)
-  (eicq-send-url))
-
-(defun eicq-toolbar-query-info-here ()
-  "Query info from the toolbar"
-  (interactive)
-  (eicq-query-info-alias-here))
-
-(defun eicq-toolbar-query-info-around ()
-  "Query info from the toolbar"
-  (interactive)
-  (eicq-query-info))
-
-(defun eicq-toolbar-update-info ()
-  "Update meta info from the toolbar"
-  (interactive)
-  (eicq-update-meta-info))
-
-(defun eicq-toolbar-search (nick-name first-name last-name email)
-  "Search from the toolbar"
-  (interactive "sNick-name: \nsFirst-name: \nsLast-name: \nsEmail: \n")
-  (eicq-search nick-name first-name last-name email))
-
-(defun eicq-toolbar-authorize-here ()
-  "Authorize from the toolbar"
-  (interactive)
-  (eicq-authorize-alias-here))
-
-(defun eicq-toolbar-authorize-around ()
-  "Authorize from the toolbar"
-  (interactive)
-  (eicq-authorize))
-
-(defun eicq-toolbar-login ()
-  "Login from the toolbar"
-  (interactive)
-  (eicq-login))
-
-(defun eicq-toolbar-logout ()
-  "Logout from the toolbar"
-  (interactive)
-  (eicq-logout))
-
-(defun eicq-toolbar-disconnect ()
-  "Disconnect from the toolbar"
-  (interactive)
-  (eicq-disconnect))
-
-(defun eicq-toolbar-log-read ()
-  "Mark log item read from the toolbar"
-  (interactive)
-  (eicq-log-mark-read))
-
-(defun eicq-toolbar-log-unread ()
-  "Mark log item unread from the toolbar"
-  (interactive)
-  (eicq-log-mark-unread))
-
-(defun eicq-toolbar-next-log ()
-  "Next log item from the toolbar"
-  (interactive)
-  (eicq-log-next 1))
-
-(defun eicq-toolbar-previous-log ()
-  "Previous log item from the toolbar"
-  (interactive)
-  (eicq-log-previous 1))
-
-(defun eicq-toolbar-new-log ()
-  "New log file from the toolbar"
-  (interactive)
-  (eicq-log-new-file))
-
-(defun eicq-toolbar-contract-log ()
-  "Contract the log from the toolbar"
-  (interactive)
-  (eicq-log-contract))
-
-(defun eicq-toolbar-expand-log ()
-  "Expand the log from the toolbar"
-  (interactive)
-  (eicq-log-expand))
-
-;; Now define the toolbar
-
-(defvar eicq-buddy-toolbar
-  '([eicq-password-icon 
-     eicq-toolbar-change-password t "Change password"]
-    [eicq-show-log-icon 
-     eicq-toolbar-show-log t "Show log"]
-    [eicq-hide-log-icon 
-     eicq-toolbar-hide-log t "Hide log"]
-    [eicq-send-message-here-icon 
-     eicq-toolbar-send-message-here t "Send message here"]
-    [eicq-send-message-around-icon
-     eicq-toolbar-send-message-around t "Send message..."]
-    [eicq-send-url-here-icon 
-     eicq-toolbar-send-url-here t "Send URL here"]
-    [eicq-send-url-around-icon 
-     eicq-toolbar-send-url-around t "Send URL..."]
-    [eicq-query-info-here-icon 
-     eicq-toolbar-query-info-here t "Query info here"]
-    [eicq-query-info-around-icon
-     eicq-toolbar-query-info-around t "Query info..."]
-    [eicq-update-info-icon 
-     eicq-toolbar-update-info t "Update info"]
-    [eicq-search-icon 
-     eicq-toolbar-search t "Search"]
-    [eicq-authorize-here-icon 
-     eicq-toolbar-authorize-here t "Authorize here"]
-    [eicq-authorize-around-icon
-     eicq-toolbar-authorize-around t "Authorize..."]
-    [eicq-login-icon
-     eicq-toolbar-login t "Login"]
-    [eicq-logout-icon
-     eicq-toolbar-logout t "Logout"]
-    [eicq-disconnect-icon
-     eicq-toolbar-disconnect t "Disconnect"])
-  "The clickety click eicq buddy toolbar")
-
-(defvar eicq-log-toolbar
-  '([eicq-send-message-here-icon 
-     eicq-toolbar-send-message-here t "Send message here"]
-    [eicq-send-message-around-icon
-     eicq-toolbar-send-message-around t "Send message..."]
-    [eicq-send-url-here-icon 
-     eicq-toolbar-send-url-here t "Send URL here"]
-    [eicq-send-url-around-icon 
-     eicq-toolbar-send-url-around t "Send URL..."]
-    [eicq-query-info-here-icon 
-     eicq-toolbar-query-info-here t "Query info here"]
-    [eicq-query-info-around-icon
-     eicq-toolbar-query-info-around t "Query info..."]
-    [eicq-authorize-here-icon 
-     eicq-toolbar-authorize-here t "Authorize here"]
-    [eicq-authorize-around-icon
-     eicq-toolbar-authorize-around t "Authorize..."]
-    [eicq-mark-log-read-icon
-     eicq-toolbar-log-read t "Mark read"]
-    [eicq-mark-log-unread-icon
-     eicq-toolbar-log-unread t "Mark unread"]
-    [eicq-next-log-icon
-     eicq-toolbar-next-log t "Next"]
-    [eicq-previous-log-icon
-     eicq-toolbar-previous-log t "Previous"]
-    [eicq-new-log-icon
-     eicq-toolbar-new-log t "New log file"]
-    [eicq-contract-log-icon
-     eicq-toolbar-contract-log t "Contract log"]
-    [eicq-expand-log-icon
-     eicq-toolbar-expand-log t "Expand log"]
-    [eicq-login-icon
-     eicq-toolbar-login t "Login"]
-    [eicq-logout-icon
-     eicq-toolbar-logout t "Logout"]
-    [eicq-disconnect-icon
-     eicq-toolbar-disconnect t "Disconnect"])
-  "A clickety click eicq log buffer toolbar")
+;;; Code:
+(defcustom eicq-icon-directory
+  "/usr/local/lib/xemacs/site-packages/etc/eicq/"
+  "*The directory where the icon files for Eicq are installed."
+  :group 'eicq-option
+  :type 'directory
+  :tag "Toolbar Directory")
 
 (defcustom eicq-use-toolbar (if (featurep 'toolbar)
 				'default-toolbar
 		 (const :tag "no toolbar" nil))
   :group 'eicq-option)
 
+;;; Internal variables
+
+(defvar eicq-password-icon
+  (toolbar-make-button-list
+   (expand-file-name "password.xpm" eicq-icon-directory))
+  "A password toolbar icon.")
+
+(defvar eicq-send-message-here-icon
+  (toolbar-make-button-list
+   (expand-file-name "send-message-here.xpm" eicq-icon-directory))
+  "A send message toolbar icon.")
+
+(defvar eicq-send-message-around-icon
+  (toolbar-make-button-list
+   (expand-file-name "send-message-around.xpm" eicq-icon-directory))
+  "A send message toolbar icon.")
+
+(defvar eicq-send-url-here-icon
+  (toolbar-make-button-list
+   (expand-file-name "url-here.xpm" eicq-icon-directory))
+  "A send URL toolbar icon.")
+
+(defvar eicq-send-url-around-icon
+  (toolbar-make-button-list
+   (expand-file-name "url-around.xpm" eicq-icon-directory))
+  "A send URL toolbar icon.")
+
+(defvar eicq-query-info-here-icon
+  (toolbar-make-button-list
+   (expand-file-name "query-here.xpm" eicq-icon-directory))
+  "A query info here toolbar icon.")
+
+(defvar eicq-query-info-around-icon
+  (toolbar-make-button-list
+   (expand-file-name "query-around.xpm" eicq-icon-directory))
+  "A query info here toolbar icon.")
+
+(defvar eicq-update-info-icon
+  (toolbar-make-button-list
+   (expand-file-name "update-info.xpm" eicq-icon-directory))
+  "A update info toolbar icon.")
+
+(defvar eicq-search-icon
+  (toolbar-make-button-list
+   (expand-file-name "search.xpm" eicq-icon-directory))
+  "A search toolbar icon.")
+
+(defvar eicq-authorize-here-icon
+  (toolbar-make-button-list
+   (expand-file-name "authorize-here.xpm" eicq-icon-directory))
+  "A authorize toolbar icon.")
+
+(defvar eicq-login-icon
+  (toolbar-make-button-list
+   (expand-file-name "login.xpm" eicq-icon-directory))
+  "A login toolbar icon.")
+
+(defvar eicq-logout-icon
+  (toolbar-make-button-list
+   (expand-file-name "logout.xpm" eicq-icon-directory))
+  "A logout toolbar icon.")
+
+(defvar eicq-disconnect-icon
+  (toolbar-make-button-list
+   (expand-file-name "disconnect.xpm" eicq-icon-directory))
+  "A disconnect toolbar icon.")
+
+(defvar eicq-new-log-icon
+  (toolbar-make-button-list
+   (expand-file-name "new-log.xpm" eicq-icon-directory))
+  "New log file toolbar icon.")
+
+;; Define the functions for the toolbar
+
+(defun eicq-toolbar-change-password (password)
+  "Change PASSWORD from the toolbar."
+  (interactive (list (read-passwd "Password: " 'confirm)))
+  (eicq-change-password password))
+
+(defun eicq-toolbar-send-message-here ()
+  "Send message from toolbar."
+  (interactive)
+  (eicq-send-message-alias-here))
+
+(defun eicq-toolbar-send-message-around ()
+  "Send message from toolbar."
+  (interactive)
+  (eicq-send-message))
+
+(defun eicq-toolbar-send-url-here ()
+  "Send URL from the toolbar."
+  (interactive)
+  (eicq-send-url-alias-here))
+
+(defun eicq-toolbar-send-url-around ()
+  "Send URL from the toolbar."
+  (interactive)
+  (eicq-send-url))
+
+(defun eicq-toolbar-query-info-here ()
+  "Query info from the toolbar."
+  (interactive)
+  (eicq-query-info-alias-here))
+
+(defun eicq-toolbar-query-info-around ()
+  "Query info from the toolbar."
+  (interactive)
+  (eicq-query-info))
+
+(defun eicq-toolbar-update-info ()
+  "Update meta info from the toolbar."
+  (interactive)
+  (eicq-update-meta-info))
+
+(defun eicq-toolbar-search (nick-name first-name last-name email)
+  "Search from the toolbar.
+Argument NICK-NAME is the ICQ name of the person you're searching for.
+Argument FIRST-NAME is the first name of the person you're searching for.
+Argument LAST-NAME is the last name of the person you are searching for.
+Argument EMAIL is the email address of the person you're searching for."
+  (interactive "sNick-name: \nsFirst-name: \nsLast-name: \nsEmail: \n")
+  (eicq-search nick-name first-name last-name email))
+
+(defun eicq-toolbar-authorize-here ()
+  "Authorize from the toolbar."
+  (interactive)
+  (eicq-authorize-alias-here))
+
+(defun eicq-toolbar-login ()
+  "Login from the toolbar."
+  (interactive)
+  (eicq-login))
+
+(defun eicq-toolbar-logout ()
+  "Logout from the toolbar."
+  (interactive)
+  (eicq-logout))
+
+(defun eicq-toolbar-disconnect ()
+  "Disconnect from the toolbar."
+  (interactive)
+  (eicq-logout)
+  (eicq-disconnect))
+
+(defun eicq-toolbar-new-log ()
+  "New log file from the toolbar."
+  (interactive)
+  (eicq-log-new-file))
+
+;; Now define the toolbar
+(defvar eicq-log-toolbar
+  '([eicq-password-icon
+     eicq-toolbar-change-password t "Change password"]
+    [eicq-send-message-here-icon
+     eicq-toolbar-send-message-here t "Send message here"]
+    [eicq-send-message-around-icon
+     eicq-toolbar-send-message-around t "Send message..."]
+    [eicq-send-url-here-icon
+     eicq-toolbar-send-url-here t "Send URL here"]
+    [eicq-send-url-around-icon
+     eicq-toolbar-send-url-around t "Send URL..."]
+    [eicq-query-info-here-icon
+     eicq-toolbar-query-info-here t "Query info here"]
+    [eicq-query-info-around-icon
+     eicq-toolbar-query-info-around t "Query info..."]
+    [eicq-search-icon
+     eicq-toolbar-search t "Search"]
+    [eicq-authorize-here-icon
+     eicq-toolbar-authorize-here t "Authorize here"]
+    [eicq-new-log-icon
+     eicq-toolbar-new-log t "New log file"]
+    [eicq-login-icon
+     eicq-toolbar-login t "Login"]
+    [eicq-logout-icon
+     eicq-toolbar-logout t "Logout"]
+    [eicq-disconnect-icon
+     eicq-toolbar-disconnect t "Disconnect"])
+  "A clickety click Eicq log buffer toolbar.")
+
 (defun eicq-install-buddy-toolbar ()
+  "Install the toolbar for `eicq-buddy-mode' in Eicq."
   (and eicq-use-toolbar
        (set-specifier (symbol-value eicq-use-toolbar)
-		      (cons 
-		       (current-buffer) eicq-buddy-toolbar))))
+		      (cons
+		       (current-buffer) eicq-log-toolbar))))
 
 (defun eicq-install-log-toolbar ()
+  "Install the toolbar for `eicq-log-mode' in Eicq."
   (and eicq-use-toolbar
        (set-specifier (symbol-value eicq-use-toolbar)
-		      (cons 
+		      (cons
 		       (current-buffer) eicq-log-toolbar))))
 
 (provide 'eicq-toolbar)
 
+;;; eicq-toolbar.el ends here
 
+
+;Local Variables:
+;time-stamp-start: "Last-Modified:[ 	]+\\\\?[\"<]+"
+;time-stamp-end: "\\\\?[\">]"
+;time-stamp-line-limit: 10
+;time-stamp-format: "%4y-%m-%d %02H:%02M:%02S (%u)"
+;End: