Posts with tag "xmpp"

Emacs appointment notifications via XMPP

By Christopher Allan Webber on Sun 21 November 2010

Since I've started using Emacs' appointment notifications with orgmode, I've wished that I could get notifications via XMPP. I think it's the most sensible system to use; I have it running on both my desktop, my phone, and my laptop, and the whole issue of "figuring out which device to send this notification to" has already been evaluated and solved by the XMPP community long long ago (back when everyone called XMPP Jabber, even ;)).

I initially thought I'd use a SleekXMPP bot connected to emacs via D-Bus, but then I decided that maybe I would eventually want to add more commands to this that integrated more closely with emacs, so maybe I should use emacs lisp directly. I had heard of Jabber.el but thought that it was mainly aimed at users who want a client, and that writing a bot in it would end up cluttering up my emacs with extra UI stuff I don't want. Then I was pointed at Steersman.el, and that seemed like a cleanly written bot, so I decided to give it a shot.

I was running a newer version of JabberEl than the copy of Steersman's code I looked at, so it took a little bit to figure out how to adjust for the multi-account code, but once I did that the implementation happened fairly quickly. Here's the relevant code:

;; Copyright (C) 2010  Christopher Allan Webber

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.

(require 'jabber)

(load-file "~/.emacs.d/emacs-jabberbot-login.el")

(defun botler->appt-message-me (min-to-app new-time appt-msg)
  "Message me about an upcoming appointment."
  (let ((message-body
         (format "Appointment %s: %s%s"
           (if (string-equal "0" min-to-app) "now"
             (format "in %s minute%s" min-to-app
                     (if (string-equal "1" min-to-app) "" "s")))
           new-time appt-msg)))
     (jabber-find-connection "")
     `(message ((to . "")
                (type . "normal"))
                (body () ,message-body)))))

; I don't care when people come online to my bot's roster.
(setq jabber-alert-presence-hooks nil)

(setq appt-display-format 'window)
(setq appt-disp-window-function 'botler->appt-message-me)
(setq appt-delete-window-function (lambda ()))

Adjust "" with your bot's JID and "" with who you want to send messages to. You can replace emacs-jabber-bot-login.el with whatevever you want to login with, but you probably want to setq jabber-account-list and then run (jabber-connect-all). Note that if you're connecting with a self-signed cert with Jabber.el you'll need to do:

(setq starttls-extra-arguments '("--insecure"))
(setq starttls-use-gnutls t)

I haven't yet figured how to whitelist my own self-signed cert yet, and passing in --insecure makes me feel like a monster, but it works for now. Maybe it's about time I finally got my ssl cert signed for

Anyway! It works, and I've been successfully getting appointment messages from my emacs session over IM for the last week, and it's pretty great. Next up, configuring things so that I can retrieve my agenda over IM when I request it and be able to IM myself new tasks and events.

Prosody is a nice XMPP server

By Christopher Allan Webber on Sun 07 March 2010

Up until recently I was using ejabberd for my XMPP server on It worked pretty well, was easy enough to set up, etc. Unfortunately it was also a total memory hog, sucking up more than 120MB of the memory on my tiny VPS. Given I was running the smallest Linode server possible (actually, I just upgraded to the second smallest today, which was pretty painless) this was making it rather difficult for me to add new services and sites.

After a very helpful conversation on, I decided to make the switch to Prosody. I'm glad to say it was quite painless: after installing the .deb off their site, making a couple lines of changes to their bundled config file, and running their ejabberd2prosody.lua script, things are running smooth. Prosody only takes about 15 megabytes of memory (including what's cached). Nice!

One word of advice: ejabberd2prosody.lua isn't bundled with Prosody's .deb files currently, so you have to run it from source. The "migrated database" that it creates is set up relative to the script's own path it seems, so you'll have to move the database it creates out of the source directory into /var/lib/prosody. After I figured that out, everything was smooth!