[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Coloring jabber contacts in org-mode tags according to availab
From: |
Andrew Hyatt |
Subject: |
[Orgmode] Coloring jabber contacts in org-mode tags according to availability |
Date: |
Sat, 2 May 2009 19:08:42 -0400 |
I like to put coworker's usernames as tags to my tasks, if I need to
interact with them to get the task done. Looking over the agenda for
the day while i decide on my next task, I decided I wanted to see if
my coworkers were available so that I don't have to check around when
deciding on my next task. So, I wrote the following function to color
my tags based on the jabber availability of the person in question
(green / yellow / red). It's not super-efficient, but it should work
quickly for most people. If there is widespread interest in this, I
can develop it into a contrib package.
(defun ash-jabber-colorize-tags ()
(let ((contact-hash (make-hash-table :test 'equal)))
(dolist (jc jabber-connections)
(dolist (contact (plist-get (fsm-get-state-data jc) :roster))
(puthash (car (split-string (symbol-name contact) "@"))
contact contact-hash)))
(save-excursion
(goto-char (point-min))
(while (re-search-forward ":\\(\\w+\\):" nil t)
(let ((tag (match-string-no-properties 1)))
(when (and tag (gethash tag contact-hash))
(let* ((js (jabber-jid-symbol (gethash tag contact-hash)))
(connected (get js 'connected))
(show (get js 'show)))
(if connected
(let ((o (make-overlay (match-beginning 1) (-
(point) 1))))
(overlay-put o 'face
(cons 'foreground-color
(cond ((equal "away" show)
"yellow")
((equal "dnd" show)
"red")
(t "green")))))))))
(backward-char)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Orgmode] Coloring jabber contacts in org-mode tags according to availability,
Andrew Hyatt <=