[bspwm] comment out the auto workspace rules
[~bandali/configs] / spacemacs / .emacs.d / private / irc / extensions.el
1 ;;; extensions.el --- irc Layer extensions File for Spacemacs
2 ;;
3 ;; Copyright (c) 2012-2014 Sylvain Benner
4 ;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
5 ;;
6 ;; Author: Sylvain Benner <sylvain.benner@gmail.com>
7 ;; URL: https://github.com/syl20bnr/spacemacs
8 ;;
9 ;; This file is not part of GNU Emacs.
10 ;;
11 ;; vbe* functions for reading passwords from authinfo by Vincent Bernat
12 ;;
13 ;;; License: GPLv3
14
15 (setq irc-pre-extensions
16 '(
17 ;; pre extension names go here
18 ))
19
20 (setq irc-post-extensions
21 '(
22 ;; post extension names go here
23 znc
24 ))
25
26 ;; For each extension, define a function irc/init-<extension-name>
27 ;;
28 (defun irc/init-znc ()
29 "Initialize znc"
30 (use-package znc
31 :load-path "private/ZNC.el"
32 :commands (znc-erc znc-all)
33 :defer t
34 :init (evil-leader/set-key
35 "aize" 'znc-erc
36 "aiza" 'znc-all)
37 :config
38 (progn
39 (defun vbe:znc-add-server (server port user networks)
40 "Add a server to the list of ZNC servers.
41 We use SSL inconditionaly. Moreover, we don't store the password
42 but put nil instead. At least, we tweak the username to contain
43 the network name later, this will be separated again."
44 (add-to-list 'znc-servers
45 (list server
46 port
47 t ; SSL enabled
48 (mapcar (function (lambda (slug) (list slug
49 (format "%s/%s" user slug)
50 nil)))
51 networks))))
52
53 (defun vbe:znc-erc-ssl-connector (&rest R)
54 "Connect to ERC using SSL and retrieve password with `auth-source-search'.
55 Moreover, handle multiple networks by sending the password with
56 the appropriate network slug that we extract from the nick."
57 (let* ((user (nth 0 (split-string (plist-get R :nick) "/")))
58 (slug (nth 1 (split-string (plist-get R :nick) "/")))
59 (found (nth 0 (auth-source-search :host (plist-get R :server)
60 :user user
61 :require '(:user :secret)
62 :max 1))))
63 (if found
64 (let ((password (let ((secret (plist-get found :secret)))
65 (if (functionp secret)
66 (funcall secret)
67 secret))))
68 (plist-put R :password (format "%s/%s:%s" user slug password))
69 (plist-put R :nick user)
70 (apply 'erc-tls R)))))
71 (setq znc-erc-ssl-connector 'vbe:znc-erc-ssl-connector)
72
73 ;; Define networks
74 (vbe:znc-add-server "aminb.org" 6697 "aminb"
75 '(freenode mozilla))
76 )
77 )
78 )
79 ;;
80 ;; Often the body of an initialize function uses `use-package'
81 ;; For more info on `use-package', see readme:
82 ;; https://github.com/jwiegley/use-package