Loads more updates -- large assortment of stuffs
[syinit] / 17-emchat-sy.el
1 ;; 17-emchat-sy.el --- EMchat Settings   -*- Emacs-Lisp -*-
2
3 ;; Copyright (C) 2007 - 2020 Steve Youngs
4
5 ;;     Author: Steve Youngs <steve@sxemacs.org>
6 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
7 ;;    Created: <2007-12-02>
8 ;; Time-stamp: <Friday Feb 14, 2020 01:48:44 steve>
9 ;;   Download: <http://bastard.steveyoungs.com/~steve/SXEmacs/inits/>
10 ;;   HTMLised: <http://bastard.steveyoungs.com/~steve/SXEmacs/htmlinits/17-emchat-sy.html>
11 ;;   Git Repo: git clone https://git.sxemacs.org/syinit
12 ;;   Keywords: init, compile
13
14 ;; This file is part of SYinit
15
16 ;; Redistribution and use in source and binary forms, with or without
17 ;; modification, are permitted provided that the following conditions
18 ;; are met:
19 ;;
20 ;; 1. Redistributions of source code must retain the above copyright
21 ;;    notice, this list of conditions and the following disclaimer.
22 ;;
23 ;; 2. Redistributions in binary form must reproduce the above copyright
24 ;;    notice, this list of conditions and the following disclaimer in the
25 ;;    documentation and/or other materials provided with the distribution.
26 ;;
27 ;; 3. Neither the name of the author nor the names of any contributors
28 ;;    may be used to endorse or promote products derived from this
29 ;;    software without specific prior written permission.
30 ;;
31 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
32 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 ;; DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
40 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
41 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
43 ;;; Commentary:
44 ;;
45 ;;   My EMchat settings.
46 ;;
47 ;;   [2020-02-12] Sadly, everything here is deprecated and non-working.  A
48 ;;   while back the ICQ people stopped using the OSCAR protocol and disallow
49 ;;   ALL 3rd-party clients. On top of that, ICQ is 100% owned and operated
50 ;;   by the Russian govt.  You probably shouldn't even use the official
51 ;;   client as they routinely hand over your chat logs and details to
52 ;;   their Russian minders.  I wish I was joking. --SY.
53
54 ;;; Credits:
55 ;;
56 ;;   The HTML version of this file was created with Hrvoje Niksic's
57 ;;   htmlize.el which is part of the XEmacs "text-modes" package.
58 ;;
59
60 ;;; Todo:
61 ;;
62 ;;     
63
64 ;;; Code:  Entire file commented, see above
65 ;:*=======================
66 ;:* emchat settings
67 ;; (setq emchat-directory
68 ;;       (file-name-as-directory
69 ;;        (expand-file-name "emchat" user-init-directory)))
70 ;; (load "emchat")
71
72 ;; ;;; Experimental stuff
73 ;; ;; EMchat works great in a tty, but some settings I use are best
74 ;; ;; suited for X, so this just turns them off.
75 ;; (defun tty-im-setup ()
76 ;;   "Set some things so I can use EMchat/Riece in tty."
77 ;;   (interactive)
78 ;;   (setq emchat-status-use-gutter nil
79 ;;      emchat-start-in-new-frame nil
80 ;;      emchat-wharf-frame-use-p nil))
81 ;; ;;; 
82
83 ;; (when (device-on-window-system-p)
84 ;;   (setq emchat-status-use-gutter t
85 ;;      emchat-start-in-new-frame t))
86
87 ;; (setq
88 ;;  emchat-doctor-enabled-flag t
89 ;;  emchat-emphasis-enabled-flag t
90 ;;  emchat-history-enabled-flag t
91 ;;  emchat-log-fill-column 72
92 ;;  emchat-port 5190
93 ;;  emchat-server "login.icq.com"
94 ;;  emchat-smiley t
95 ;;  emchat-track-enable t
96 ;;  emchat-track-indicator-type 'char
97 ;;  emchat-user-alias "JackaLX"
98 ;;  emchat-user-password (getenv "ICQPASSWD")
99 ;;  emchat-user-meta-nickname "JackaLX"
100 ;;  emchat-user-meta-firstname "Steve"
101 ;;  emchat-user-meta-lastname "Youngs"
102 ;;  emchat-user-meta-primary-email "steve@sxemacs.org"
103 ;;  emchat-user-meta-secondary-email "steve@steveyoungs.com"
104 ;;  emchat-user-meta-city "Brisbane"
105 ;;  emchat-user-meta-state "DOA"
106 ;;  emchat-user-meta-hide-ip t
107 ;;  emchat-user-meta-authorization t
108 ;;  emchat-user-meta-about 
109 ;;  "EMchat Maintainer.\n
110 ;;  If you'd like to help out with the EMchat project,
111 ;;  please send me a message.  Or go to:
112 ;;     <http://www.emchat.org/>\n
113 ;;  SXEmacs - It's not just an editor.
114 ;;           It's a way of life!
115 ;;     <http://www.sxemacs.org/>"
116 ;;  emchat-user-meta-homepage "http://www.sxemacs.org/"
117 ;;  emchat-user-meta-sex 'male
118 ;;  emchat-user-meta-language-1 12
119 ;;  emchat-user-meta-language-2 12
120 ;;  emchat-user-meta-language-3 12
121 ;;  emchat-user-meta-web-aware t
122 ;;  emchat-user-initial-status "online"
123 ;;  emchat-user-meta-age 38
124 ;;  emchat-user-meta-birth-day 19
125 ;;  emchat-user-meta-birth-month 6
126 ;;  emchat-user-meta-birth-year 66
127 ;;  emchat-user-meta-cell-phone "6666 6666"
128 ;;  emchat-user-meta-country 61
129 ;;  emchat-user-meta-fax "7777 7777"
130 ;;  emchat-user-meta-phone "8888 8888"
131 ;;  emchat-user-meta-street "1 Linux Lane"
132 ;;  emchat-user-meta-work-homepage "http://www.sxemacs.org/"
133 ;;  emchat-user-meta-work-address "What me, work?"
134 ;;  emchat-user-meta-work-city "Penguinville"
135 ;;  emchat-user-meta-work-company "SlackBiz"
136 ;;  emchat-user-meta-work-department "Slackers"
137 ;;  emchat-user-meta-work-fax "9999 9999"
138 ;;  emchat-user-meta-work-phone "5555 5555"
139 ;;  emchat-user-meta-work-position "Seated"
140 ;;  emchat-user-meta-work-state "DOA"
141 ;;  emchat-user-meta-zipcode "9999"
142 ;;  emchat-buddy-view 'emchat-all-aliases
143 ;;  emchat-use-sound-flag nil
144 ;;  emchat-save-log-on-exit-p nil
145 ;;  emchat-log-debug-flag t
146 ;;  emchat-user-meta-invisible nil
147 ;;  emchat-buddy-show-avatar t
148 ;;  emchat-buddy-xface-foreground "black"
149 ;;  emchat-buddy-xface-background "red")
150
151 ;; ;; PulseAudio only seems to work if X is running
152 ;; (when (getenv "DISPLAY")
153 ;;   (setq  emchat-use-sound-flag t))
154
155 ;; ;; Lets not auto-away.
156 ;; (customize-set-variable 'emchat-auto-away-timeout 0)
157
158 ;; (emchat-world-update)
159
160 ;; (when emchat-use-sound-flag
161 ;;   (setq emchat-audio-device
162 ;;      ;(make-audio-device 'alsa))
163 ;;      (make-audio-device 'pulse
164 ;;                         :client "SXEmacs::EMchat"
165 ;;                         :stream "EMchat::Stream"
166 ;;                         :role "phone"))
167 ;;   ;; SXEmacs doesn't like current ffmpeg, and SoX is dodgy ATM too
168 ;;   (setq emchat-media-driver 'sndfile)
169 ;;   (setq default-media-stream-volume 50)
170 ;;   (setq emchat-sound-alist
171 ;;      '((auth-sound . "Auth.wav")
172 ;;        (buddy-sound . "Online.wav")
173 ;;        (chat-sound . "Chat.wav")
174 ;;        (emailx-sound . "System.wav")
175 ;;        (message-sound . "Message.wav")
176 ;;        (pager-sound . "System.wav")
177 ;;        (system-sound . "System.wav")
178 ;;        (url-sound . "URL.wav"))))
179
180
181 ;; ;:*=======================
182 ;; ;:* Addons/extensions
183
184 ;; (defun sy-emchat-now-playing ()
185 ;;   "Return title/artist of current song."
186 ;;   (interactive)
187 ;;   (format "NP: %s" (mpd-now-playing)))
188
189 ;; (defun sy-emchat-send-now-playing ()
190 ;;   "Send title/artist of current song."
191 ;;   (interactive)
192 ;;   (let ((song (sy-emchat-now-playing))
193 ;;      (alias (emchat-alias-around)))
194 ;;     (emchat-send-message song alias)))
195
196 ;; (defun sy-emchat-yow ()
197 ;;   "When you can't think of what to say..."
198 ;;   (interactive)
199 ;;   (let ((message (yow))
200 ;;      (alias (emchat-alias-around)))
201 ;;     (emchat-send-message message alias)))
202
203
204 ;; (require 'emchat-menu)
205 ;; (define-key emchat-log-mode-map (kbd "C-c p") #'sy-emchat-send-now-playing)
206 ;; (define-key emchat-log-mode-map (kbd "C-c y") #'sy-emchat-yow)
207
208 ;; ;:*=======================
209 ;; ;:* Hooks
210 ;; (eval-when-compile
211 ;;   (defvar alias)
212 ;;   (defvar message))
213
214 ;; ;;(defun sy-emchat-temp (&optional fahrenheit)
215 ;; ;;  "Returns a string to send to a ICQ user saying the current temp.
216
217 ;; ;;With optional arg, FAHRENHEIT, don't send the temp in celsius."
218 ;; ;;  (if fahrenheit
219 ;; ;;      (let ((xwem-weather-temperature-format 'fahrenheit))
220 ;; ;;   (format "The current temperature here is: %s°F"
221 ;; ;;           (substring (xwem-weather-get-temp) 0 -2)))
222 ;; ;;    (let ((xwem-weather-temperature-format 'celsius))
223 ;; ;;      (format "The current temperature here is: %s°C"
224 ;; ;;         (substring (xwem-weather-get-temp) 0 -2)))))
225
226 ;; (defconst sy-beer-love
227 ;;   ["when you realise, 24 beers in a case, 24 hours in a day.  Coincidence?"
228 ;;    "when you wake up with `CRS'... Can't Remember Shit."
229 ;;    "when, to you, it's not a six-pack, it's a support group."
230 ;;    "when it is the reason you get up every afternoon."
231 ;;    "when you favour the 2 party system... party on Friday, party on Saturday."
232 ;;    "when getting f#@ked up is your hobby."]
233 ;;   "Proof you love beer.")
234
235 ;; (defun sy-emchat-beer-love ()
236 ;;   (let ((prefix "You know you love beer... ")
237 ;;      (love (aref sy-beer-love
238 ;;                  (% (+ (% (random t) 1000) 1000)
239 ;;                     (length sy-beer-love)))))
240 ;;     (concat prefix love)))
241
242 ;; (defun sy-emchat-incoming-msg-hook ()
243 ;;   (when (or (member alias emchat-visible-contacts)
244 ;;          (not (member alias emchat-invisible-contacts)))
245 ;;     (let ((repo "The main EMchat git repo is:
246 ;; git clone https://git.emchat.org/emchat")
247 ;;        (download "EMchat source tarballs and (S)XEmacs pkg tarballs
248 ;; can be downloaded from:  Offline ATM, sorry")
249 ;;        (latest (shell-command-to-string
250 ;;                 "cd ~/programming/EMchat/emchat && git describe"))
251 ;;        (lastlog (shell-command-to-string
252 ;;                  "cd ~/programming/EMchat/emchat && git log -1"))
253 ;;        (time (format-time-string "The local time here is: %c"))
254 ;;        (beer (sy-emchat-beer-love))
255 ;;        (song (sy-emchat-now-playing))
256 ;;        (help "Cmds are prefixed with `,,' (ie, ,,cmd).  Only the first
257 ;; valid cmd in a msg is accepted.  The cmd can appear anywhere in
258 ;; the msg.
259
260 ;; Accepted cmds: version, latest, lastlog, emchat-repo, download, yow,
261 ;; time, beer, song, help."))
262 ;;       (cond ((string-match ",,version" message)
263 ;;           (emchat-send-message-helper
264 ;;            (format "I am using %s" (emchat-version)) (list alias)
265 ;;            'automatic "Version sent"))
266 ;;          ((string-match ",,latest" message)
267 ;;           (emchat-send-message-helper latest (list alias) 'automatic "Latest sent"))
268 ;;          ((string-match ",,lastlog" message)
269 ;;           (emchat-send-message-helper lastlog (list alias) 'automatic "Lastlog sent"))
270 ;;          ((string-match ",,emchat-repo" message)
271 ;;           (emchat-send-message-helper repo (list alias) 'automatic "Repo sent"))
272 ;;          ((string-match ",,download" message)
273 ;;           (emchat-send-message-helper download (list alias) 'automatic "Download sent"))
274 ;;          ((string-match ",,yow" message)
275 ;;           (emchat-send-message-helper (format "%s" (yow)) (list alias)
276 ;;                                     'automatic "Yow sent"))
277 ;;          ((string-match ",,time" message)
278 ;;           (emchat-send-message-helper time (list alias) 'automatic "Time sent"))
279 ;;                                      ;((string-match ",,temp-f" message)
280 ;;                                      ; (emchat-send-message (sy-emchat-temp 'fahrenheit) alias))
281 ;;                                      ;((string-match ",,temp" message)
282 ;;                                      ; (emchat-send-message (sy-emchat-temp) alias))
283 ;;          ((string-match ",,beer" message)
284 ;;           (emchat-send-message-helper beer (list alias) 'automatic "Beer sent"))
285 ;;          ((string-match ",,song" message)
286 ;;           (emchat-send-message-helper song (list alias) 'automatic "Song sent"))
287 ;;          ((string-match ",,help" message)
288 ;;           (emchat-send-message-helper help (list alias) 'automatic "Help sent"))))))
289
290 ;; (add-hook 'emchat-new-message-hook #'sy-emchat-incoming-msg-hook)
291
292 ;; (defun sy-emchat-zero-wharf ()
293 ;;   "Helper func to zero wharf counters."
294 ;;   (interactive)
295 ;;   (emchat-wharf-change-messages "New" -9999)
296 ;;   (emchat-wharf-change-messages "Sys" -9999))
297
298 ;; ;; Use the Wharf if not using XWEM
299 ;; (unless (or (string= "notyet" (getenv "XWEM_RUNNING"))
300 ;;          (string= "yes" (getenv "XWEM_RUNNING"))
301 ;;          (not (device-on-window-system-p)))
302 ;;   (require 'emchat-wharf)
303 ;;   (setq emchat-wharf-frame-use-p t)
304 ;;   (setq emchat-wharf-notice-riece-flag t)
305 ;;   (push (cons 'left 1690) emchat-wharf-frame-props)
306 ;;   (push (cons 'top 5) emchat-wharf-frame-props)
307 ;;   (push (cons 'internal-border-width 4) emchat-wharf-frame-props)
308 ;;   ;; `override-redirect' means no WM decorations, and you also get
309 ;;   ;; sticky and always on top and skip pagers and task lists etc.
310 ;;   ;; The downside is that often new windows will appear underneath
311 ;;   ;; because the WM/DE has no knowledge of its existence.  I don't
312 ;;   ;; use this in KDE because you can easily get the same effect
313 ;;   ;; without the downside with KDE's "Window Rules".  I also don't
314 ;;   ;; use this in Sawfish for similar reasons.
315 ;;   (unless (or (string= (getenv "KDE_FULL_SESSION") "true")
316 ;;            (string= (getenv "SAWFISH_IS_RUNNING") "true"))
317 ;;     (push (cons 'override-redirect t) emchat-wharf-frame-props))
318 ;;   (push (cons 'border-width 1) emchat-wharf-frame-props)
319 ;;   (push (cons 'border-color "red") emchat-wharf-frame-props)
320 ;;   (add-hook 'emchat-new-message-hook #'emchat-wharf-inc-messages)
321 ;;   (add-hook 'emchat-system-message-hook #'emchat-wharf-inc-system)
322 ;;   (add-hook 'emchat-read-message-hook #'emchat-wharf-dec-messages)
323 ;;   (add-hook 'riece-biff-activity-hook #'emchat-wharf-riece-active)
324 ;;   (add-hook 'riece-biff-clear-hook #'emchat-wharf-riece-inactive)
325 ;;   (add-hook 'emchat-track-clear-hook #'sy-emchat-zero-wharf)
326 ;;   (define-key emchat-log-mode-map [?C] #'sy-emchat-zero-wharf))
327
328 ;; ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*
329 ;; (message "EMchat settings loaded")