(require 'jabber nil t)
(require 'jabber-autoloads nil t)
(if (boundp 'jabber-account-list)
(add-to-list 'jabber-account-list `(,(concat "eric@warmenhoven.org/" (mapconcat 'identity (split-string system-name "[-.]") ""))
(:network-server . "talk.google.com")
(:connection-type . ssl))))
(setq fsm-debug nil)
(setq jabber-roster-show-bindings nil)
(setq jabber-show-resources nil)
(setq jabber-show-offline-contacts nil)
(setq jabber-roster-sort-functions '(jabber-roster-sort-by-displayname))
(setq jabber-roster-line-format " %-50n %u %-8s %S")
(setq jabber-roster-show-title nil)
(setq jabber-auto-reconnect t)
(add-hook 'jabber-post-connect-hooks 'jabber-keepalive-start)
(setq jabber-chatstates-confirm nil)
(setq jabber-chat-fill-long-lines nil)
(add-hook 'jabber-chat-mode-hook 'flyspell-mode)
(add-hook 'jabber-chat-mode-hook '(lambda () (cd "~/")))
(add-hook 'jabber-alert-message-hooks 'jabber-message-beep)
(setq jabber-alert-presence-message-function 'jabber-presence-only-chat-open-message)
(defadvice jabber-presence-default-message (after eaw-jabber-presence-with-time)
"Append the time to status messages"
(setq ad-return-value (concat ad-return-value " at " (current-time-string))))
(ad-activate 'jabber-presence-default-message)
(defadvice jabber-xml-get-children (after eaw-remove-anonymous)
(setq ad-return-value (remove '(mechanism nil "ANONYMOUS") ad-return-value)))
(ad-activate 'jabber-xml-get-children)
(setq jabber-history-enabled t
jabber-use-global-history t
jabber-global-history-filename (locate-user-emacs-file "var/jabber.log"))
(setq jabber-vcard-avatars-retrieve nil)
(setq jabber-avatar-cache-directory (locate-user-emacs-file "var/jabber-avatars/"))
(defun eaw-jabber-connected-kill-hook ()
"Query the user as to whether killing Emacs should be cancelled
when connected to jabber"
(if (and (boundp '*jabber-connected*) *jabber-connected*)
(yes-or-no-p
"You are connected to Jabber, are you sure you want to quit? ")
t))
(add-to-list 'kill-emacs-query-functions 'eaw-jabber-connected-kill-hook)
(defun eaw-jabber-font-setup ()
(set-face-attribute 'jabber-roster-user-online nil :foreground 'unspecified)
(set-face-attribute 'jabber-roster-user-xa nil :slant 'normal :foreground "dark green")
(set-face-attribute 'jabber-roster-user-dnd nil :slant 'normal :foreground "dark green")
(set-face-attribute 'jabber-roster-user-away nil :slant 'normal :foreground "green")
(set-face-attribute 'jabber-roster-user-error nil :slant 'normal)
(set-face-attribute 'jabber-roster-user-offline nil :slant 'normal :foreground "dark grey")
(set-face-attribute 'jabber-title-small nil :inherit 'default :width 'normal :foreground "blue" :height 'unspecified)
(set-face-attribute 'jabber-title-medium nil :inherit 'default :width 'normal :height 'unspecified)
(set-face-attribute 'jabber-title-large nil :inherit 'default :width 'normal :height 'unspecified))
(add-hook 'jabber-roster-mode-hook 'eaw-jabber-font-setup)
(provide 'ew-jabber)