;;; emchat-menu.el --- Menus and keymaps for EMchat. ;; Copyright (C) 2002 - 2011 Steve Youngs ;; Author: Steve Youngs ;; Maintainer: Steve Youngs ;; Created: 2002-10-01 ;; Homepage: http://www.emchat.org/ ;; Keywords: comm ICQ ;; This file is part of EMchat. ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions ;; are met: ;; ;; 1. Redistributions of source code must retain the above copyright ;; notice, this list of conditions and the following disclaimer. ;; ;; 2. Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; ;; 3. Neither the name of the author nor the names of any contributors ;; may be used to endorse or promote products derived from this ;; software without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;; Code (eval-when-compile (require 'emchat-utils)) ;; Global bindings. ;; Define new prefix for EMchat (define-prefix-command 'emchat-prefix) ;; Set EMchat global bindings (define-key emchat-prefix "Xi" #'emchat-login) (define-key emchat-prefix "w" #'emchat-show-window) (define-key emchat-prefix "f" #'world-find) ;; Bindings common to both log and buddy buffer. (defvar emchat-main-map (let ((map (make-keymap 'emchat-main-map))) (suppress-keymap map) (define-key map [X] nil) ; BUG? (define-key map [X i] #'emchat-login) (define-key map [X o] #'emchat-logout) (define-key map [X q] #'emchat-exit) (define-key map [X s] #'emchat-change-status) (define-key map [b] #'emchat-toggle-invisibility) (define-key map [S] #'emchat-group-select-aliases) (define-key map [s] #'emchat-group-select-aliases) (define-key map [w] #'emchat-show-window) (define-key map [H] #'emchat-history-save) (define-key map [h] #'emchat-hide-window) (define-key map [M] #'emchat-send-message) (define-key map [m] #'emchat-send-message) (define-key map [U] #'emchat-send-url) (define-key map [u] #'emchat-send-url) (define-key map [A] #'emchat-authorize) (define-key map [a] #'emchat-authorize) (define-key map [i] #'emchat-query-info) (define-key map [I] #'emchat-query-info) (define-key map [F] #'emchat-search) (define-key map [f] #'world-find) (define-key map [V] nil) (define-key map [V c] #'emchat-buddy-view-connected) (define-key map [V v] #'emchat-buddy-view-active) (define-key map [V a] #'emchat-buddy-view-all) map) "Keyboard map common for `emchat-log-mode-map' and `emchat-buddy-mode-map'.") (defvar emchat-main-menu '("EMchat" ["Show Window" emchat-show-window t] ["Hide Window" emchat-hide-window t] ["Register New UIN" emchat-register-new-user t] ["Change Password" emchat-change-password t] ["Login" emchat-login t] ["Logout" emchat-logout t] ["Exit" emchat-exit t] "---" ["Select" emchat-group-select-aliases t] ["Send Message" emchat-send-message t] ["Send URL" emchat-send-url t] ["Authorize" emchat-authorize t] ["Change Status" emchat-change-status t] ["Change Idle Timeout" emchat-change-idle-timeout t] ["Search" emchat-search t] ["Update Meta Info" emchat-update-meta-info t] "---" ["alias -> uin" emchat-alias-uin t] ["uin -> alias" emchat-uin-alias t] ["Redo Packet" emchat-redo-hex t] ["Resend Contact List" emchat-send-contact-list t] ["Buddy Buffer" emchat-buddy-show-buffer t] ["Log Buffer" emchat-log-show-buffer t] "---" ["Email Author" emchat-email-author t] ["Submit Bug Report" (emchat-report-bug emchat-blurb) t] ["Make a Donation" emchat-donation t] ["Customize" emchat-customize t]) "Menu for both `emchat-log-mode' and `emchat-buddy-mode'.") (easy-menu-define emchat-main-easymenu nil "EMchat" emchat-main-menu) (defvar emchat-log-menu '("EMchat-log" ["Select Around" emchat-select-alias-around t] ["Send Message Around" emchat-send-message-alias-around t] ["Send URL Around" emchat-send-url-alias-around t] ["Forward Message" emchat-forward-message-around t] ["Oops!" emchat-oops t] ["Authorize Around" emchat-authorize-alias-around t] ["Query Around" emchat-query-info-alias-around t] ["History Around" emchat-history-around t] "---" ["New Log File" emchat-log-new-file t] ["Contract Log" emchat-log-contract t] ["Expand Log" emchat-log-expand t] ["Previous Log" emchat-log-previous t] ["Next Log" emchat-log-next t] "---" ["Mark Read" emchat-log-mark-read t] ["Mark Unread" emchat-log-mark-unread t]) "Menu for `emchat-log-mode'.") (easy-menu-define emchat-buddy-easymenu nil "Buddy" emchat-log-menu) (defvar emchat-log-mode-map (let ((map (make-sparse-keymap 'emchat-log-mode-map))) (set-keymap-parents map (list emchat-main-map)) (define-key map [delete] #'emchat-log-contract) (define-key map [insert] #'emchat-log-expand) (define-key map [(control up)] #'emchat-log-previous) (define-key map [(control down)] #'emchat-log-next) (define-key map [v] #'emchat-log-mark-unread) (define-key map [c] #'emchat-log-mark-read) (define-key map [W] #'emchat-alias-around) (define-key map [s] #'emchat-select-alias-around) (define-key map [m] #'emchat-send-message-alias-around) (define-key map [u] #'emchat-send-url-alias-around) (define-key map [a] #'emchat-authorize-alias-around) (define-key map [i] #'emchat-query-info-alias-around) (define-key map [f] #'emchat-forward-message-around) (define-key map [n] #'emchat-log-next-unread) (define-key map [N] #'emchat-log-next) (define-key map [o] #'emchat-switch-to-buddy-buffer) (define-key map [O] #'emchat-oops) (define-key map [p] #'emchat-log-previous-unread) (define-key map [P] #'emchat-log-previous) (define-key map [t] #'emchat-history-around) (define-key map [T] #'emchat-history) map) "Keymap for `emchat-log-mode'.") (defvar emchat-history-menu '("EMchat-History" ["Prev Event" emchat-history-prev t] ["Next Event" emchat-history-next t] ["Save Histories" emchat-history-save t] ["Quit" emchat-history-bury-buffer t]) "Menu for `emchat-history-mod'.") (defvar emchat-history-mode-map (let ((map (make-sparse-keymap 'emchat-history-mode-map))) (define-key map [n] #'emchat-history-next) (define-key map [p] #'emchat-history-prev) (define-key map [s] #'emchat-history-save) (define-key map [q] #'emchat-history-bury-buffer) map) "Keymap for `emchat-history-mode'.") (easy-menu-define emchat-history-easymenu nil "History" emchat-history-menu) (defvar emchat-buddy-menu '("EMchat-Buddy" ["Select Here" emchat-select-alias-here t] ["Select By Status" emchat-buddy-select-all-in-view-by-status t] ["Select By Regexp" emchat-buddy-select-all-in-view-by-regexp t] ["Send Message Here" emchat-send-message-alias-here t] ["Send URL Here" emchat-send-url-alias-here t] ["Authorize Here" emchat-authorize-alias-here t] ["Query Info Here" emchat-query-info-alias-here t] ["History Here" emchat-history-here-other-window t] "---" ["View Connected" emchat-buddy-view-connected t] ["View Active" emchat-buddy-view-active t] ["View All" emchat-buddy-view-all t]) "Menu for `emchat-buddy-mode'.") (easy-menu-define emchat-log-easymenu nil "Log" emchat-buddy-menu) (defvar emchat-alias-map (let ((map (make-sparse-keymap 'emchat-alias-map))) (define-key map [button2] #'emchat-send-message-via-mouse) map) "Keymap for alias extent.") (defvar emchat-hyperlink-map (let ((map (make-sparse-keymap 'emchat-hyperlink-map))) (define-key map [button2] #'emchat-emphasis-visit-hyperlink-at-mouse) (define-key map [return] #'emchat-emphasis-visit-hyperlink-at-point) (emchat-do-in-sxemacs (define-key map [(control button2)] #'emchat-curl-url-at-mouse) (define-key map [(control return)] #'emchat-curl-url-at-point) (define-key map [d] #'emchat-curl-url-at-point)) map) "Keymap for the hyperlink extents.") (defvar emchat-buddy-mode-map (let ((map (make-sparse-keymap 'emchat-buddy-mode-map))) (set-keymap-parents map (list emchat-main-map)) (define-key map [W] #'emchat-alias-here) (define-key map [s] #'emchat-select-alias-here) (define-key map [m] #'emchat-send-message-alias-here) (define-key map [u] #'emchat-send-url-alias-here) (define-key map [a] #'emchat-authorize-alias-here) (define-key map [i] #'emchat-query-info-alias-here) (define-key map [n] #'next-line) (define-key map [o] #'emchat-switch-to-log-buffer) (define-key map [p] #'previous-line) (define-key map [t] #'emchat-history-here-other-window) map) "Keymap for `emchat-buddy-mode'.") (provide 'emchat-menu) ;;; emchat-menu.el ends here