Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

New modules #17

Merged
merged 2 commits into from

2 participants

@ryuslash

This includes both my identica-mode and jabber.el modules. I hope they are of use to anyone, if you have any suggestions, questions or critiques I would be glad to hear them.

ryuslash added some commits
@ryuslash ryuslash Add sauron-identica module
sauron-identica shows how many new dents have been found by
identica-mode
2752f8f
@ryuslash ryuslash Add sauron-jabber module
sauron-jabber shows jabber.el events in sauron.
32080f2
@djcb djcb merged commit 7dbbda1 into from
@djcb
Owner

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 26, 2012
  1. @ryuslash

    Add sauron-identica module

    ryuslash authored
    sauron-identica shows how many new dents have been found by
    identica-mode
  2. @ryuslash

    Add sauron-jabber module

    ryuslash authored
    sauron-jabber shows jabber.el events in sauron.
This page is out of date. Refresh to see the latest.
Showing with 177 additions and 2 deletions.
  1. +16 −2 README.org
  2. +60 −0 sauron-identica.el
  3. +101 −0 sauron-jabber.el
View
18 README.org
@@ -229,8 +229,8 @@
** the backend modules
- Currently, four backend modules have been implemented - *ERC*, *org-mode*, *d-bus*
- and *notifications* (for emacs 24). Hopefully, more will follow.
+ Currently, five backend modules have been implemented - *ERC*, *org-mode*, *d-bus*,
+ *notifications* (for emacs 24) and *identica-mode*. Hopefully, more will follow.
*** erc
@@ -348,6 +348,20 @@
functions listed in the `sauron-event-added-functions' hook, as to not
create some infinite recursion.
+*** identi.ca
+
+ =sauron-identica= shows the number of new dents found by =identica-mode= whenever
+ there is at least one new dent.
+
+*** jabber
+
+ =sauron-jabber= shows events from =jabber.el=, this includes new messages, info
+ messages, presence alerts and lost connections.
+
+ The info, presence and connection events get priority 2, so by default you won't
+ get to see these. The others get priority 3, so those /should/ be visible by
+ default.
+
** adding new modules
It may be interesting to track other modules as well; this shouldn't be too
View
60 sauron-identica.el
@@ -0,0 +1,60 @@
+;;; sauron-identica.el --- Identica notifications for sauron
+;;
+;; Copyright (C) 2012 Tom Willemsen <tom@ryuslash.org>
+
+;; This file is not part of GNU Emacs.
+;;
+;; Sauron 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 of the License, or
+;; (at your option) any later version.
+
+;; Sauron is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; For documentation, please see:
+;; https://github.com/djcb/sauron/blob/master/README.org
+
+;;; Code:
+(require 'identica-mode nil 'noerror)
+
+(defvar sr-identica-running nil
+ "*internal* whether sauron identica is running.")
+
+(defun sauron-identica-start ()
+ "Start watching identica."
+ (if (not (boundp 'identica-mode-version))
+ (progn
+ (message "sauron-identica not available")
+ nil)
+ (unless sr-identica-running
+ (add-hook 'identica-new-dents-hook
+ 'sr-identica-new-dents-func)
+ (setq sr-identica-running t))
+ t))
+
+(defun sauron-identica-stop ()
+ "Stop watching identica."
+ (when sr-identica-running
+ (remove-hook 'identica-new-dents-hook
+ 'sr-identica-new-dents-func)
+ (setq sr-identica-running nil)))
+
+(defun sr-identica-new-dents-func ()
+ "Print the # of new dents."
+ (sauron-add-event
+ 'identica 3
+ (if (= identica-new-dents-count 1)
+ "There is 1 new dent."
+ (format "There are %i new dents." identica-new-dents-count))
+ 'identica))
+
+(provide 'sauron-identica)
+
+;;; sauron-identica.el ends here
View
101 sauron-jabber.el
@@ -0,0 +1,101 @@
+;;; sauron-jabber.el --- Jabber notifications for sauron
+
+;; Copyright (C) 2012 Tom Willemsen <tom@ryuslash.org>
+
+;; This file is not part of GNU Emacs.
+;;
+;; Sauron 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 of the License, or
+;; (at your option) any later version.
+
+;; Sauron is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; For documentation, please see:
+;; https://github.com/djcb/sauron/blob/master/README.org
+
+;;; Code:
+(require 'jabber nil 'noerror)
+
+(defvar sr-jabber-running nil
+ "*internal* whether sauron jabber is running.")
+
+(defun sauron-jabber-start ()
+ "Start watching jabber."
+ (if (not (boundp 'jabber-version))
+ (progn
+ (message "sauron-jabber not available")
+ nil)
+ (unless sr-jabber-running
+ (add-hook 'jabber-alert-message-hooks
+ 'sr-jabber-alert-message-func)
+ (add-hook 'jabber-alert-muc-hooks
+ 'sr-jabber-alert-muc-func)
+ (add-hook 'jabber-alert-info-message-hooks
+ 'sr-jabber-alert-info-message-func)
+ (add-hook 'jabber-alert-presence-hooks
+ 'sr-jabber-alert-presence-func)
+ (add-hook 'jabber-lost-connection-hooks
+ 'sr-jabber-lost-connection-func)
+ (setq sr-jabber-running t))
+ t))
+
+(defun sauron-jabber-stop ()
+ "Stop watching jabber."
+ (when sr-jabber-running
+ (remove-hook 'jabber-alert-message-hooks
+ 'sr-jabber-alert-message-func)
+ (remove-hook 'jabber-alert-info-message-hooks
+ 'sr-jabber-alert-info-message-func)
+ (remove-hook 'jabber-alert-muc-hooks
+ 'sr-jabber-alert-muc-func)
+ (remove-hook 'jabber-alert-presence-hooks
+ 'sr-jabber-alert-presence-func)
+ (remove-hook 'jabber-lost-connection-hooks
+ 'sr-jabber-lost-connection-func)
+ (setq sr-jabber-running nil)))
+
+(defun sr-jabber-alert-message-func (from buffer text
+ proposed-alert)
+ (let ((name (jabber-jid-displayname from)))
+ (sauron-add-event 'jabber 3 proposed-alert
+ `(lambda ()
+ (sauron-switch-to-marker-or-buffer
+ ,(buffer-name buffer))))))
+
+(defun sr-jabber-alert-info-message-func (what buffer
+ proposed-alert)
+ (sauron-add-event 'jabber 2 proposed-alert
+ `(lambda ()
+ (sauron-switch-to-marker-or-buffer
+ ,(buffer-name buffer)))))
+
+(defun sr-jabber-alert-muc-func (nick group buffer text
+ proposed-alert)
+ (sauron-add-event 'jabber 3 proposed-alert
+ `(lambda ()
+ (sauron-switch-to-marker-or-buffer
+ ,(buffer-name buffer)))))
+
+(defun sr-jabber-alert-presence-func (who oldstatus newstatus
+ statustext
+ proposed-alert)
+ (if (not (or (string-equal proposed-alert "")
+ (eq proposed-alert nil)))
+ (sauron-add-event 'jabber 2 proposed-alert)))
+
+(defun sr-jabber-lost-connection-func (conn)
+ (sauron-add-event 'jabber 2 (format "Connection for %s lost"
+ (jabber-jid-username
+ (jabber-connection-jid conn)))))
+
+(provide 'sauron-jabber)
+
+;;; sauron-jabber.el ends here
Something went wrong with that request. Please try again.