Created
July 18, 2013 13:27
-
-
Save tdavis/6029278 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;; hipchat.el -- Random functions for Hipchat | |
| ;; Copyright (C) 2013 Tom Davis <tom@recursivedream.com> | |
| ;; Author: Tom Davis <tom@recursivedream.com> | |
| ;; Version: 0.1 | |
| ;; Created: 2013-07-17 | |
| ;; Keywords: Emacs Hipchat Bitlbee | |
| ;; This file is NOT part of GNU Emacs. | |
| ;;; License | |
| ;; 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 2 | |
| ;; of the License, 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 | |
| ;; 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 this program; if not, write to the Free Software | |
| ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| ;; | |
| ;; Commentary: | |
| ;; | |
| ;; This package provides some generic functions, hooks, etc. to ease | |
| ;; some interop issues between erc+bitlbee and Hipchat. | |
| ;; | |
| ;;; Code: | |
| (require 'erc) | |
| (defun hipchat-ping () | |
| "Insert @<NICK> at point, where NICK is the user's configured Jabber nickname." | |
| (interactive) | |
| (with-current-buffer "&bitlbee" | |
| (kill-new (hipchat--jabber-nick | |
| (completing-read "Name:\s" erc-channel-users)))) | |
| (insert "@" (pop kill-ring) " ")) | |
| (defun hipchat--jabber-nick (nick) | |
| "Consult Jabber to get the real nickname of NICK" | |
| (with-current-buffer "&bitlbee" | |
| (goto-char (point-max)) | |
| (erc-bol) | |
| (insert "info" " " nick) | |
| (erc-send-current-line) | |
| (re-search-backward "Nickname: \\([A-Za-z0-9\-_]+\\)") | |
| (match-string-no-properties 1))) | |
| (provide 'hipchat) | |
| ;;; hipchat.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment