forked from fgeller/emacs-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-erc.el
54 lines (45 loc) · 1.82 KB
/
init-erc.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(setq erc-nick "felix^^")
(setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
(setq erc-auto-query 'frame)
(defun fg/connect-to-bitlbee ()
(interactive)
(erc :server "localhost"
:nick "me"))
;; http://emacs-fu.blogspot.de/2012/03/social-networking-with-bitlbee-and-erc.html
(defun fg/bitlbee-identify ()
(when (and (string= "localhost" erc-session-server)
(string= "&bitlbee" (buffer-name)))
(erc-message "PRIVMSG" (format "%s identify %s"
(erc-default-target)
fg/bitlbee-password))))
(add-hook 'erc-join-hook 'fg/bitlbee-identify)
(defun fg/connect-to-iptego ()
(interactive)
(erc :server "irc.iptego"
:nick "felix^^"))
(defun fg/connect-to-freenode ()
(interactive)
(erc :server "irc.freenode.net"
:nick "felix^^"
:password fg/freenode-password))
(defun fg/notify-privmsg (proc parsed)
(let ((nick (car (erc-parse-user (erc-response.sender parsed))))
(target (car (erc-response.command-args parsed)))
(msg (erc-response.contents parsed)))
(when (and (erc-current-nick-p target)
(not (erc-is-message-ctcp-and-not-action-p msg)))
(todochiku-message (format "ERC message from: %s" nick)
msg
(todochiku-icon 'irc)
nil)))
nil)
(defun fg/notify-nick-mentioned (match-type nick msg)
(when (eq match-type 'current-nick)
(todochiku-message (format "%s mentioned your nick." (car (split-string nick "!")))
msg
(todochiku-icon 'irc)
t)))
(add-hook 'erc-text-matched-hook 'fg/notify-nick-mentioned)
(add-hook 'erc-server-PRIVMSG-functions 'fg/notify-privmsg t)
(add-hook 'erc-server-PRIVMSG-functions 'erc-server-PRIVMSG t)
(provide 'init-erc)