;; 17-emchat-sy.el --- EMchat Settings -*- Emacs-Lisp -*- ;; Copyright (C) 2007 - 2012 Steve Youngs ;; Author: Steve Youngs ;; Maintainer: Steve Youngs ;; Created: <2007-12-02> ;; Time-stamp: ;; Download: ;; HTMLised: ;; Git Repo: git clone http://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. ;; ;;; 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: ;:*======================= ;:* emchat settings (load "emchat") ;;; Experimental stuff ;; EMchat works great in a tty, but some setttings 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-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: \n SXEmacs - It's not just an editor. It's a way of life! " 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-xface t) ;; PulseAudio only seems to work if X is running (when (getenv "DISPLAY") (setq emchat-use-sound-flag t)) (customize-set-variable 'emchat-auto-away-timeout 1200) (emchat-world-update) (when emchat-use-sound-flag (setq emchat-audio-device ;(make-audio-device 'alsa :device "plughw:0,0")) ;(make-audio-device 'ao :driver "alsa")) ;; Pulseaudio is CRAP!! (make-audio-device 'pulse :client "SXEmacs::EMchat" :stream "EMchat::Stream")) ;; SXEmacs doesn't like current ffmpeg (setq emchat-media-driver 'sndfile) (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 (defvar **mpd-var-Title* nil) (defvar **mpd-var-Artist* nil) (defun sy-emchat-now-playing () "Return title/artist of current song." (interactive) (let ((song (if **mpd-var-Title* (format "%s --- [%s]" **mpd-var-Title* **mpd-var-Artist*) "The Sounds of Silence --- [Marcel Marceau]"))) (format "NP: %s" song))) (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 http://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 1578) emchat-wharf-frame-props) (push (cons 'top 289) 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 ;(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")