]> crepu.dev Git - config.git/blob - djavu-asus/elpa/jabber-20230715.456/jabber-menu.el
Archivo de configuraciĆ³n de la terminal
[config.git] / djavu-asus / elpa / jabber-20230715.456 / jabber-menu.el
1 ;; jabber-menu.el - menu definitions -*- lexical-binding: t; -*-
2
3 ;; Copyright (C) 2003, 2004, 2008 - Magnus Henoch - mange@freemail.hu
4 ;; Copyright (C) 2002, 2003, 2004 - tom berger - object@intelectronica.net
5
6 ;; This file is a part of jabber.el.
7
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2 of the License, or
11 ;; (at your option) any later version.
12
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
17
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program; if not, write to the Free Software
20 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 (require 'jabber-util)
23 (eval-when-compile (require 'cl-lib))
24
25 ;;;###autoload
26 (defvar jabber-menu
27 (let ((map (make-sparse-keymap "jabber-menu")))
28 (define-key-after map
29 [jabber-menu-connect]
30 '("Connect" . jabber-connect-all))
31
32 (define-key-after map
33 [jabber-menu-disconnect]
34 '(menu-item "Disconnect" jabber-disconnect
35 :enable (bound-and-true-p jabber-connections)))
36
37 (define-key-after map
38 [jabber-menu-status]
39 `(menu-item "Set Status" ,(make-sparse-keymap "set-status")
40 :enable (bound-and-true-p jabber-connections)))
41
42 (define-key map
43 [jabber-menu-status jabber-menu-status-chat]
44 '(menu-item
45 "Chatty"
46 (lambda ()
47 (interactive)
48 (jabber-send-presence "chat"
49 (jabber-read-with-input-method "status message: " *jabber-current-status* '*jabber-status-history*)
50 *jabber-current-priority*))
51 :button (:radio . (and (boundp '*jabber-current-show*)
52 (equal *jabber-current-show* "chat")))))
53 (define-key map
54 [jabber-menu-status jabber-menu-status-dnd]
55 '(menu-item
56 "Do not Disturb"
57 (lambda ()
58 (interactive)
59 (jabber-send-presence "dnd"
60 (jabber-read-with-input-method "status message: " *jabber-current-status* '*jabber-status-history*)
61 *jabber-current-priority*))
62 :button (:radio . (and (boundp '*jabber-current-show*)
63 (equal *jabber-current-show* "dnd")))))
64 (define-key map
65 [jabber-menu-status jabber-menu-status-xa]
66 '(menu-item "Extended Away" jabber-send-xa-presence
67 :button (:radio . (and (boundp '*jabber-current-show*)
68 (equal *jabber-current-show* "xa")))))
69 (define-key map
70 [jabber-menu-status jabber-menu-status-away]
71 '(menu-item "Away" jabber-send-away-presence
72 :button (:radio . (and (boundp '*jabber-current-show*)
73 (equal *jabber-current-show* "away")))))
74 (define-key map
75 [jabber-menu-status jabber-menu-status-online]
76 '(menu-item "Online" jabber-send-default-presence
77 :button (:radio . (and (boundp '*jabber-current-show*)
78 (equal *jabber-current-show* "")))))
79
80 (define-key-after map
81 [separator]
82 '(menu-item "--"))
83
84 (define-key-after map
85 [jabber-menu-chat-with]
86 '(menu-item "Chat with..." jabber-chat-with
87 :enable (bound-and-true-p jabber-connections)))
88
89 (define-key-after map
90 [jabber-menu-nextmsg]
91 '(menu-item "Next unread message" jabber-activity-switch-to
92 :enable (bound-and-true-p jabber-activity-jids)))
93
94 (define-key-after map
95 [jabber-menu-send-subscription-request]
96 '(menu-item "Send subscription request" jabber-send-subscription-request
97 :enable (bound-and-true-p jabber-connections)))
98
99 (define-key-after map
100 [jabber-menu-roster]
101 '("Switch to roster" . jabber-switch-to-roster-buffer))
102
103 (define-key-after map
104 [separator2]
105 '(menu-item "--"))
106
107 (define-key-after map
108 [jabber-menu-customize]
109 '("Customize" . jabber-customize))
110
111 (define-key-after map
112 [jabber-menu-info]
113 '("Help" . jabber-info))
114
115 map))
116
117 ;;;###autoload
118 (defcustom jabber-display-menu 'maybe
119 "Decide whether the \"Jabber\" menu is displayed in the menu bar.
120 If t, always display.
121 If nil, never display.
122 If maybe, display if jabber.el is installed under `package-user-dir', or
123 if any of `jabber-account-list' or `jabber-connections' is non-nil."
124 :group 'jabber
125 :type '(choice (const :tag "Never" nil)
126 (const :tag "Always" t)
127 (const :tag "When installed by user, or when any accounts have been configured or connected" maybe)))
128
129 (defun jabber-menu (&optional remove)
130 "Put \"Jabber\" menu on menubar.
131 With prefix argument, remove it."
132 (interactive "P")
133 (setq jabber-display-menu (if remove nil t))
134 (force-mode-line-update))
135 (make-obsolete 'jabber-menu "set the variable `jabber-display-menu' instead." "27.2")
136
137 ;;;###autoload
138 (define-key-after (lookup-key global-map [menu-bar])
139 [jabber-menu]
140 (list 'menu-item "Jabber" jabber-menu
141 :visible
142 '(or (eq jabber-display-menu t)
143 (and (eq jabber-display-menu 'maybe)
144 (or (bound-and-true-p jabber-account-list)
145 (bound-and-true-p jabber-connections))))))
146
147 (defvar jabber-jid-chat-menu nil
148 "Menu items for chat menu.")
149
150 (defvar jabber-jid-info-menu nil
151 "Menu item for info menu.")
152
153 (defvar jabber-jid-roster-menu nil
154 "Menu items for roster menu.")
155
156 (defvar jabber-jid-muc-menu nil
157 "Menu items for MUC menu.")
158
159 (defvar jabber-jid-service-menu nil
160 "Menu items for service menu.")
161
162 (defun jabber-popup-menu (which-menu)
163 "Popup specified menu."
164 (let* ((mouse-event (and (listp last-input-event) last-input-event))
165 (choice (widget-choose "Actions" which-menu mouse-event)))
166 (if mouse-event
167 (mouse-set-point mouse-event))
168 (if choice
169 (call-interactively choice))))
170
171 (defun jabber-popup-chat-menu ()
172 "Popup chat menu."
173 (interactive)
174 (jabber-popup-menu jabber-jid-chat-menu))
175
176 (defun jabber-popup-info-menu ()
177 "Popup info menu."
178 (interactive)
179 (jabber-popup-menu jabber-jid-info-menu))
180
181 (defun jabber-popup-roster-menu ()
182 "Popup roster menu."
183 (interactive)
184 (jabber-popup-menu jabber-jid-roster-menu))
185
186 (defun jabber-popup-muc-menu ()
187 "Popup MUC menu."
188 (interactive)
189 (jabber-popup-menu jabber-jid-muc-menu))
190
191 (defun jabber-popup-service-menu ()
192 "Popup service menu."
193 (interactive)
194 (jabber-popup-menu jabber-jid-service-menu))
195
196 (defun jabber-popup-combined-menu ()
197 "Popup combined menu."
198 (interactive)
199 (jabber-popup-menu (append jabber-jid-chat-menu jabber-jid-info-menu jabber-jid-roster-menu jabber-jid-muc-menu)))
200
201 (provide 'jabber-menu)
202
203 ;;; arch-tag: 5147f52f-de47-4348-86ff-b799d7a75e3f