;; 17-emchat.el --- EMchat Settings

;; Copyright (C) 2007 - 2020 Steve Youngs

;;     Author: Steve Youngs <steve@sxemacs.org>
;; Maintainer: Steve Youngs <steve@sxemacs.org>
;;    Created: <2007-12-02>
;; Time-stamp: <Thursday Apr  9, 2020 19:14:30 steve>
;;   Download: <https://downloads.sxemacs.org/SYinits>
;;   HTMLised: <https://www.sxemacs.org/SYinits/17-emchat.html>
;;   Git Repo: git clone https://git.sxemacs.org/syinit
;;   Keywords: init, compile

;; This file is part of SYinit

;; 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.

;;; Commentary:
;;
;;   My EMchat settings.
;;
;;   [2020-02-12] Sadly, everything here is deprecated and non-working.  A
;;   while back the ICQ people stopped using the OSCAR protocol and disallow
;;   ALL 3rd-party clients. On top of that, ICQ is 100% owned and operated
;;   by the Russian govt.  You probably shouldn't even use the official
;;   client as they routinely hand over your chat logs and details to
;;   their Russian minders.  I wish I was joking. --SY.

;;; Credits:
;;
;;   The HTML version of this file was created with Hrvoje Niksic's
;;   htmlize.el which is part of the XEmacs "text-modes" package.
;;

;;; Todo:
;;
;;     

;;; Code:  Entire file commented, see above
;:*=======================
;:* emchat settings
;; (setq emchat-directory
;;       (file-name-as-directory
;;        (expand-file-name "emchat" user-init-directory)))
;; (load "emchat")

;; ;;; Experimental stuff
;; ;; EMchat works great in a tty, but some settings I use are best
;; ;; suited for X, so this just turns them off.
;; (defun tty-im-setup ()
;;   "Set some things so I can use EMchat/Riece in tty."
;;   (interactive)
;;   (setq emchat-status-use-gutter nil
;;      emchat-start-in-new-frame nil
;;      emchat-wharf-frame-use-p nil))
;; ;;; 

;; (when (device-on-window-system-p)
;;   (setq emchat-status-use-gutter t
;;      emchat-start-in-new-frame t))

;; (setq
;;  emchat-doctor-enabled-flag t
;;  emchat-emphasis-enabled-flag t
;;  emchat-history-enabled-flag t
;;  emchat-log-fill-column 72
;;  emchat-port 5190
;;  emchat-server "login.icq.com"
;;  emchat-smiley t
;;  emchat-track-enable t
;;  emchat-track-indicator-type 'char
;;  emchat-user-alias "JackaLX"
;;  emchat-user-password (getenv "ICQPASSWD")
;;  emchat-user-meta-nickname "JackaLX"
;;  emchat-user-meta-firstname "Steve"
;;  emchat-user-meta-lastname "Youngs"
;;  emchat-user-meta-primary-email "steve@sxemacs.org"
;;  emchat-user-meta-secondary-email "steve@steveyoungs.com"
;;  emchat-user-meta-city "Brisbane"
;;  emchat-user-meta-state "DOA"
;;  emchat-user-meta-hide-ip t
;;  emchat-user-meta-authorization t
;;  emchat-user-meta-about 
;;  "EMchat Maintainer.\n
;;  If you'd like to help out with the EMchat project,
;;  please send me a message.  Or go to:
;;     <http://www.emchat.org/>\n
;;  SXEmacs - It's not just an editor.
;;           It's a way of life!
;;     <http://www.sxemacs.org/>"
;;  emchat-user-meta-homepage "http://www.sxemacs.org/"
;;  emchat-user-meta-sex 'male
;;  emchat-user-meta-language-1 12
;;  emchat-user-meta-language-2 12
;;  emchat-user-meta-language-3 12
;;  emchat-user-meta-web-aware t
;;  emchat-user-initial-status "online"
;;  emchat-user-meta-age 38
;;  emchat-user-meta-birth-day 19
;;  emchat-user-meta-birth-month 6
;;  emchat-user-meta-birth-year 66
;;  emchat-user-meta-cell-phone "6666 6666"
;;  emchat-user-meta-country 61
;;  emchat-user-meta-fax "7777 7777"
;;  emchat-user-meta-phone "8888 8888"
;;  emchat-user-meta-street "1 Linux Lane"
;;  emchat-user-meta-work-homepage "http://www.sxemacs.org/"
;;  emchat-user-meta-work-address "What me, work?"
;;  emchat-user-meta-work-city "Penguinville"
;;  emchat-user-meta-work-company "SlackBiz"
;;  emchat-user-meta-work-department "Slackers"
;;  emchat-user-meta-work-fax "9999 9999"
;;  emchat-user-meta-work-phone "5555 5555"
;;  emchat-user-meta-work-position "Seated"
;;  emchat-user-meta-work-state "DOA"
;;  emchat-user-meta-zipcode "9999"
;;  emchat-buddy-view 'emchat-all-aliases
;;  emchat-use-sound-flag nil
;;  emchat-save-log-on-exit-p nil
;;  emchat-log-debug-flag t
;;  emchat-user-meta-invisible nil
;;  emchat-buddy-show-avatar t
;;  emchat-buddy-xface-foreground "black"
;;  emchat-buddy-xface-background "red")

;; ;; PulseAudio only seems to work if X is running
;; (when (getenv "DISPLAY")
;;   (setq  emchat-use-sound-flag t))

;; ;; Lets not auto-away.
;; (customize-set-variable 'emchat-auto-away-timeout 0)

;; (emchat-world-update)

;; (when emchat-use-sound-flag
;;   (setq emchat-audio-device
;;      ;(make-audio-device 'alsa))
;;      (make-audio-device 'pulse
;;                         :client "SXEmacs::EMchat"
;;                         :stream "EMchat::Stream"
;;                         :role "phone"))
;;   ;; SXEmacs doesn't like current ffmpeg, and SoX is dodgy ATM too
;;   (setq emchat-media-driver 'sndfile)
;;   (setq default-media-stream-volume 50)
;;   (setq emchat-sound-alist
;;      '((auth-sound . "Auth.wav")
;;        (buddy-sound . "Online.wav")
;;        (chat-sound . "Chat.wav")
;;        (emailx-sound . "System.wav")
;;        (message-sound . "Message.wav")
;;        (pager-sound . "System.wav")
;;        (system-sound . "System.wav")
;;        (url-sound . "URL.wav"))))


;; ;:*=======================
;; ;:* Addons/extensions

;; (defun sy-emchat-now-playing ()
;;   "Return title/artist of current song."
;;   (interactive)
;;   (format "NP: %s" (mpd-now-playing)))

;; (defun sy-emchat-send-now-playing ()
;;   "Send title/artist of current song."
;;   (interactive)
;;   (let ((song (sy-emchat-now-playing))
;;      (alias (emchat-alias-around)))
;;     (emchat-send-message song alias)))

;; (defun sy-emchat-yow ()
;;   "When you can't think of what to say..."
;;   (interactive)
;;   (let ((message (yow))
;;      (alias (emchat-alias-around)))
;;     (emchat-send-message message alias)))


;; (require 'emchat-menu)
;; (define-key emchat-log-mode-map (kbd "C-c p") #'sy-emchat-send-now-playing)
;; (define-key emchat-log-mode-map (kbd "C-c y") #'sy-emchat-yow)

;; ;:*=======================
;; ;:* Hooks
;; (eval-when-compile
;;   (defvar alias)
;;   (defvar message))

;; ;;(defun sy-emchat-temp (&optional fahrenheit)
;; ;;  "Returns a string to send to a ICQ user saying the current temp.

;; ;;With optional arg, FAHRENHEIT, don't send the temp in celsius."
;; ;;  (if fahrenheit
;; ;;      (let ((xwem-weather-temperature-format 'fahrenheit))
;; ;;   (format "The current temperature here is: %s°F"
;; ;;           (substring (xwem-weather-get-temp) 0 -2)))
;; ;;    (let ((xwem-weather-temperature-format 'celsius))
;; ;;      (format "The current temperature here is: %s°C"
;; ;;         (substring (xwem-weather-get-temp) 0 -2)))))

;; (defconst sy-beer-love
;;   ["when you realise, 24 beers in a case, 24 hours in a day.  Coincidence?"
;;    "when you wake up with `CRS'... Can't Remember Shit."
;;    "when, to you, it's not a six-pack, it's a support group."
;;    "when it is the reason you get up every afternoon."
;;    "when you favour the 2 party system... party on Friday, party on Saturday."
;;    "when getting f#@ked up is your hobby."]
;;   "Proof you love beer.")

;; (defun sy-emchat-beer-love ()
;;   (let ((prefix "You know you love beer... ")
;;      (love (aref sy-beer-love
;;                  (% (+ (% (random t) 1000) 1000)
;;                     (length sy-beer-love)))))
;;     (concat prefix love)))

;; (defun sy-emchat-incoming-msg-hook ()
;;   (when (or (member alias emchat-visible-contacts)
;;          (not (member alias emchat-invisible-contacts)))
;;     (let ((repo "The main EMchat git repo is:
;; git clone https://git.emchat.org/emchat")
;;        (download "EMchat source tarballs and (S)XEmacs pkg tarballs
;; can be downloaded from:  Offline ATM, sorry")
;;        (latest (shell-command-to-string
;;                 "cd ~/programming/EMchat/emchat && git describe"))
;;        (lastlog (shell-command-to-string
;;                  "cd ~/programming/EMchat/emchat && git log -1"))
;;        (time (format-time-string "The local time here is: %c"))
;;        (beer (sy-emchat-beer-love))
;;        (song (sy-emchat-now-playing))
;;        (help "Cmds are prefixed with `,,' (ie, ,,cmd).  Only the first
;; valid cmd in a msg is accepted.  The cmd can appear anywhere in
;; the msg.

;; Accepted cmds: version, latest, lastlog, emchat-repo, download, yow,
;; time, beer, song, help."))
;;       (cond ((string-match ",,version" message)
;;           (emchat-send-message-helper
;;            (format "I am using %s" (emchat-version)) (list alias)
;;            'automatic "Version sent"))
;;          ((string-match ",,latest" message)
;;           (emchat-send-message-helper latest (list alias) 'automatic "Latest sent"))
;;          ((string-match ",,lastlog" message)
;;           (emchat-send-message-helper lastlog (list alias) 'automatic "Lastlog sent"))
;;          ((string-match ",,emchat-repo" message)
;;           (emchat-send-message-helper repo (list alias) 'automatic "Repo sent"))
;;          ((string-match ",,download" message)
;;           (emchat-send-message-helper download (list alias) 'automatic "Download sent"))
;;          ((string-match ",,yow" message)
;;           (emchat-send-message-helper (format "%s" (yow)) (list alias)
;;                                     'automatic "Yow sent"))
;;          ((string-match ",,time" message)
;;           (emchat-send-message-helper time (list alias) 'automatic "Time sent"))
;;                                      ;((string-match ",,temp-f" message)
;;                                      ; (emchat-send-message (sy-emchat-temp 'fahrenheit) alias))
;;                                      ;((string-match ",,temp" message)
;;                                      ; (emchat-send-message (sy-emchat-temp) alias))
;;          ((string-match ",,beer" message)
;;           (emchat-send-message-helper beer (list alias) 'automatic "Beer sent"))
;;          ((string-match ",,song" message)
;;           (emchat-send-message-helper song (list alias) 'automatic "Song sent"))
;;          ((string-match ",,help" message)
;;           (emchat-send-message-helper help (list alias) 'automatic "Help sent"))))))

;; (add-hook 'emchat-new-message-hook #'sy-emchat-incoming-msg-hook)

;; (defun sy-emchat-zero-wharf ()
;;   "Helper func to zero wharf counters."
;;   (interactive)
;;   (emchat-wharf-change-messages "New" -9999)
;;   (emchat-wharf-change-messages "Sys" -9999))

;; ;; Use the Wharf if not using XWEM
;; (unless (or (string= "notyet" (getenv "XWEM_RUNNING"))
;;          (string= "yes" (getenv "XWEM_RUNNING"))
;;          (not (device-on-window-system-p)))
;;   (require 'emchat-wharf)
;;   (setq emchat-wharf-frame-use-p t)
;;   (setq emchat-wharf-notice-riece-flag t)
;;   (push (cons 'left 1690) emchat-wharf-frame-props)
;;   (push (cons 'top 5) emchat-wharf-frame-props)
;;   (push (cons 'internal-border-width 4) emchat-wharf-frame-props)
;;   ;; `override-redirect' means no WM decorations, and you also get
;;   ;; sticky and always on top and skip pagers and task lists etc.
;;   ;; The downside is that often new windows will appear underneath
;;   ;; because the WM/DE has no knowledge of its existence.  I don't
;;   ;; use this in KDE because you can easily get the same effect
;;   ;; without the downside with KDE's "Window Rules".  I also don't
;;   ;; use this in Sawfish for similar reasons.
;;   (unless (or (string= (getenv "KDE_FULL_SESSION") "true")
;;            (string= (getenv "SAWFISH_IS_RUNNING") "true"))
;;     (push (cons 'override-redirect t) emchat-wharf-frame-props))
;;   (push (cons 'border-width 1) emchat-wharf-frame-props)
;;   (push (cons 'border-color "red") emchat-wharf-frame-props)
;;   (add-hook 'emchat-new-message-hook #'emchat-wharf-inc-messages)
;;   (add-hook 'emchat-system-message-hook #'emchat-wharf-inc-system)
;;   (add-hook 'emchat-read-message-hook #'emchat-wharf-dec-messages)
;;   (add-hook 'riece-biff-activity-hook #'emchat-wharf-riece-active)
;;   (add-hook 'riece-biff-clear-hook #'emchat-wharf-riece-inactive)
;;   (add-hook 'emchat-track-clear-hook #'sy-emchat-zero-wharf)
;;   (define-key emchat-log-mode-map [?C] #'sy-emchat-zero-wharf))

;; ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*
;; (message "EMchat settings loaded")
Created with SXEmacs Valid XHTML 1.0 Transitional!
Copyright © 2020 Steve Youngs
Verbatim copying and distribution is permitted in any medium, providing this notice is preserved.
Last modified: Wed Apr 15 18:16:13 AEST 2020