;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\302\303\304\305\306\307%\210\310\311\312\313\306\303\314\315&\210\310\316\317\320\306\303\321\322&\210\310\323\324\325\306\303\321\322&\210\310\326\327\330\306\303\321\331&\210\310\332\333\334\306\303\321\331&\210\310\335\304\336\306\303\321\337\340\341& \210\310\342\304\343\306\303\321\344\340\345& \210\310\346\347\350\306\303\321\331&\210\310\351\304\352\306\303\321\353&\207" [require time-date custom-declare-group jabber-autoaway nil "Change status to away after idleness" :group jabber custom-declare-variable jabber-autoaway-methods (if (fboundp 'jabber-autoaway-method) (list jabber-autoaway-method) (list 'jabber-current-idle-time 'jabber-xprintidle-get-idle-time 'jabber-termatime-get-idle-time)) "Methods used to keep track of idleness.\nThis is a list of functions that takes no arguments, and returns the\nnumber of seconds since the user was active, or nil on error." :options (jabber-current-idle-time jabber-xprintidle-get-idle-time jabber-termatime-get-idle-time) jabber-autoaway-timeout 5 "Minutes of inactivity before changing status to away" :type number jabber-autoaway-xa-timeout 10 "Minutes of inactivity before changing status to xa. Set to 0 to disable." jabber-autoaway-status "Idle" "Status string for autoaway" string jabber-autoaway-xa-status "Extended away" "Status string for autoaway in xa state" jabber-autoaway-priority "Priority for autoaway.\nIf nil, don't change priority. See the manual for more\ninformation about priority." (choice (const :tag "Don't change") (integer :tag "Priority")) :link (info-link "(jabber)Presence") jabber-autoaway-xa-priority "Priority for autoaway in xa state.\nIf nil, don't change priority. See the manual for more\ninformation about priority." (choice (const :tag "Don't change") (integer :tag "Priority")) (info-link "(jabber)Presence") jabber-xprintidle-program (executable-find "xprintidle") "Name of the xprintidle program" jabber-autoaway-verbose "If nil, don't print autoaway status messages." boolean] 10) (defvar jabber-autoaway-timer nil) #@107 Seconds of idle time the last time we checked. This is used to detect whether the user has become unidle. (defvar jabber-autoaway-last-idle-time nil (#$ . 2143)) (defalias 'jabber-autoaway-message #[(&rest args) "\205\302\303 \"\207" [jabber-autoaway-verbose args apply message] 3]) #@114 Start autoaway timer. The IGNORED argument is there so you can put this function in `jabber-post-connect-hooks'. (defalias 'jabber-autoaway-start #[(&optional ignored) "?\205\302 \303_\304\300#\305\306!\207" [jabber-autoaway-timer jabber-autoaway-timeout run-with-timer 60 nil jabber-autoaway-message "Autoaway timer started"] 4 (#$ . 2436) nil]) #@22 Stop autoaway timer. (defalias 'jabber-autoaway-stop #[nil "\205 \301!\210\302\303\304!\207" [jabber-autoaway-timer jabber-cancel-timer nil jabber-autoaway-message "Autoaway timer stopped"] 2 (#$ . 2793) nil]) #@85 Get idle time in seconds according to jabber-autoaway-methods. Return nil on error. (defalias 'jabber-autoaway-get-idle-time #[nil "\301\302\303\"\304\"@\207" [jabber-autoaway-methods sort mapcar funcall #[(a b) "\205 \203\f W\207\302\207" [a b t] 2]] 4 (#$ . 3013)]) (defalias 'jabber-autoaway-timer #[nil "\303\304 \211\247\205\" \305\n_V\203\306 \202\"\307\305\n_ Z\303\300#\211)\207" [jabber-autoaway-timer idle-time jabber-autoaway-timeout nil jabber-autoaway-get-idle-time 60 jabber-autoaway-set-idle run-with-timer] 5]) (defalias 'jabber-autoaway-set-idle #[(&optional xa) "\306\307!\210\310\235\204?\311 \203\312\202\313\n \230\204 \n\f\230\203, \203( \202-\f\202-\n \2036\2028\206=#\210\314  ?\205P\315\316\211\317#\211\207" [*jabber-current-show* xa *jabber-current-status* jabber-default-status jabber-autoaway-status jabber-autoaway-xa-status jabber-autoaway-message "Autoaway triggered" ("xa" "dnd") jabber-send-presence "xa" "away" jabber-autoaway-get-idle-time run-with-timer 10 jabber-autoaway-maybe-unidle jabber-autoaway-priority jabber-autoaway-xa-priority *jabber-current-priority* jabber-autoaway-last-idle-time jabber-autoaway-timer] 4]) (defalias 'jabber-autoaway-maybe-unidle #[nil "\306 \307\310\"\210 \311\235\205V\nV\203, \312V\203&\313 _V\203&\314\315!\210\211\202V\307\316!\210\f \230\204=\f\230\203C\317 \210\202Q\320\f#\210\307\321\f #\210\322 \210\323 )\207" [idle-time *jabber-current-show* jabber-autoaway-last-idle-time jabber-autoaway-xa-timeout *jabber-current-status* jabber-autoaway-status jabber-autoaway-get-idle-time jabber-autoaway-message "Idle for %d seconds" ("xa" "away") 0 60 jabber-autoaway-set-idle t "Back to unidle" jabber-send-default-presence jabber-send-presence "%S /= %S - not resetting presence" jabber-autoaway-stop jabber-autoaway-start jabber-autoaway-xa-status jabber-default-show jabber-default-priority] 4]) #@47 Get idle time through the xprintidle program. (defalias 'jabber-xprintidle-get-idle-time #[nil "\205 \302\303\304\"r q\210\305\216\306\307\304#\310U\205\311\312 !\313\245+\207" [jabber-xprintidle-program #1=#:temp-buffer generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] call-process nil 0 string-to-number buffer-string 1000.0] 4 (#$ . 4949)]) #@103 Get idle time through atime of terminal. The method for finding the terminal only works on GNU/Linux. (defalias 'jabber-termatime-get-idle-time #[nil "\303\304!\203\n\304\202 \305\211\205$\306\307!8\310\311 !!\211\312V\205#\n*)\207" [terminal atime-of-tty diff file-exists-p "/proc/self/fd/0" nil 4 file-attributes time-to-seconds time-since 0] 4 (#$ . 5353)]) #@92 Get idle time through `current-idle-time'. `current-idle-time' was introduced in Emacs 22. (defalias 'jabber-current-idle-time #[nil "\301\302!\205\302 \211\204\303\202\304!)\207" [idle-time fboundp current-idle-time 0 float-time] 3 (#$ . 5728)]) (provide 'jabber-autoaway)