forked from emacs-circe/circe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circe.el
3544 lines (3070 loc) · 132 KB
/
circe.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; circe.el --- Client for IRC in Emacs -*- lexical-binding: t -*-
;; Copyright (C) 2005 - 2015 Jorgen Schaefer
;; Version: 2.0
;; Keywords: IRC, chat
;; Author: Jorgen Schaefer <[email protected]>
;; URL: https://github.com/jorgenschaefer/circe
;; This file is part of Circe.
;; 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 3 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, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Circe is a Client for IRC in Emacs. It integrates well with the rest
;; of the editor, using standard Emacs key bindings and indicating
;; activity in channels in the status bar so it stays out of your way
;; unless you want to use it.
;;; Code:
(defvar circe-version "2.0"
"Circe version string.")
(require 'circe-compat)
(require 'ring)
(require 'timer)
(require 'lui)
(require 'lui-format)
(require 'lcs)
(require 'irc)
;; Used to be optional. But sorry, we're in the 21st century already.
(require 'lui-irc-colors)
(enable-lui-irc-colors)
(defgroup circe nil
"Yet Another Emacs IRC Client."
:prefix "circe-"
:group 'applications)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Customization Options ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;
;;;; Faces ;;;;
;;;;;;;;;;;;;;;
(defface circe-prompt-face
'((t (:weight bold :foreground "Black" :background "LightSeaGreen")))
"The face for the Circe prompt."
:group 'circe)
(defface circe-server-face
'((((type tty)) :foreground "blue" :weight bold)
(t (:foreground "SteelBlue")))
"The face used to highlight server messages."
:group 'circe)
(defface circe-highlight-nick-face
'((((type tty)) (:foreground "cyan" :weight bold))
(t (:foreground "CadetBlue3" :weight bold)))
"The face used to highlight messages directed to us."
:group 'circe)
(defface circe-my-message-face '((t))
"The face used to highlight our own messages."
:group 'circe)
(defface circe-originator-face '((t))
"The face used to highlight the originator of a message."
:group 'circe)
(defface circe-topic-diff-new-face '((t (:background "DarkGreen")))
"The face used for text added to a topic.
See the {topic-diff} parameter to `circe-format-server-topic'."
:group 'circe)
(defface circe-topic-diff-removed-face '((t (:background "DarkRed")))
"The face used for text removed from a topic.
See the {topic-diff} parameter to `circe-format-server-topic'."
:group 'circe)
(defface circe-fool-face
'((((type tty)) (:foreground "grey40" :bold t))
(((type x)) (:foreground "grey40")))
"The face used for fools.
See `circe-fool-list'."
:group 'circe)
;;;;;;;;;;;;;;;;;;;
;;;; Variables ;;;;
;;;;;;;;;;;;;;;;;;;
(defcustom circe-default-nick (user-login-name)
"The default nick for circe."
:type 'string
:group 'circe)
(defcustom circe-default-user circe-default-nick
"The default user name for circe."
:type 'string
:group 'circe)
(defcustom circe-default-realname (if (string= (user-full-name) "")
circe-default-nick
(user-full-name))
"The default real name for circe."
:type 'string
:group 'circe)
(defcustom circe-default-ip-family nil
"Default IP family to use.
'nil - Use either IPv4 or IPv6.
'ipv4 - Use IPv4
'ipv6 - Use IPv6"
:type '(choice (const :tag "Both" nil)
(const :tag "IPv4" ipv4)
(const :tag "IPv6" ipv6))
:group 'circe)
(defcustom circe-default-directory "~/"
"The value of `default-directory' for Circe buffers."
:type 'string
:group 'circe)
(defcustom circe-network-options nil
"Network options.
This alist maps network names to respective options.
Common options:
:pass - The IRC server password to use for this network, or a
function to fetch it.
:nick - The nick name to use (defaults to `circe-default-nick')
:user - The user name to use (defaults to `circe-default-user')
:realname - The real name to use (defaults to `circe-default-realname')
:channels - A plist of channels to join (see `circe-channels').
:server-buffer-name - Format to be used for the server buffer name
(see `circe-server-buffer-name')
:host - The host name of the server to connect to.
:port - The port or service name for the server.
:use-tls - A boolean indicating as to whether to use TLS or
not (defaults to nil). If you set this, you'll likely
have to set :port as well.
:ip-family - Option to enforce a specific IP version
(defaults to `circe-default-ip-family')
:nickserv-nick - The nick to authenticate with to nickserv, if configured.
(defaults to the value of :nick)
:nickserv-password - The password to use for nickserv
authentication or a function to fetch it.
:sasl-username - The username for SASL authentication.
:sasl-password - The password for SASL authentication."
:type '(alist :key-type string :value-type plist)
:group 'circe)
(defvar circe-network-defaults
'(("Freenode" :host "irc.freenode.net" :port (6667 . 6697)
:tls t
:nickserv-mask "^NickServ!NickServ@services\\.$"
:nickserv-identify-challenge "\C-b/msg\\s-NickServ\\s-identify\\s-<password>\C-b"
:nickserv-identify-command "PRIVMSG NickServ :IDENTIFY {nick} {password}"
:nickserv-identify-confirmation "^You are now identified for .*\\.$"
:nickserv-ghost-command "PRIVMSG NickServ :GHOST {nick} {password}"
:nickserv-ghost-confirmation "has been ghosted\\.$\\|is not online\\.$"
)
("Coldfront" :host "irc.coldfront.net" :port 6667
:nickserv-mask "^NickServ!services@coldfront\\.net$"
:nickserv-identify-challenge "/msg\\s-NickServ\\s-IDENTIFY\\s-\C-_password\C-_"
:nickserv-identify-command "PRIVMSG NickServ :IDENTIFY {password}"
)
("Bitlbee" :host "localhost" :port 6667
:nickserv-mask "\\(bitlbee\\|root\\)!\\(bitlbee\\|root\\)@"
:nickserv-identify-challenge "use the \x02identify\x02 command to identify yourself"
:nickserv-identify-command "PRIVMSG &bitlbee :identify {password}"
:nickserv-identify-confirmation "Password accepted, settings and accounts loaded"
)
("OFTC" :host "irc.oftc.net" :port (6667 . 6697)
:nickserv-mask "^NickServ!services@services\\.oftc\\.net$"
:nickserv-identify-challenge "This nickname is registered and protected."
:nickserv-identify-command "PRIVMSG NickServ :IDENTIFY {password} {nick}"
:nickserv-identify-confirmation "^You are successfully identified as .*\\.$"
)
)
"Alist of networks and connection settings.
See the `circe' command for details of this variable.")
(defcustom circe-default-quit-message "Using Circe, the loveliest of all IRC clients"
"The default quit message when no other is given.
This is sent when the server buffer is killed or when /QUIT is
given with no argument."
:type 'string
:group 'circe)
(defcustom circe-default-part-message "Using Circe, the loveliest of all IRC clients"
"How to part when a channel buffer is killed, or when no
argument is given to /PART."
:type 'string
:group 'circe)
(defcustom circe-auto-query-max 23
"The maximum number of queries which are opened automatically.
If more messages arrive - typically in a flood situation - they
are displayed in the server buffer."
:type 'integer
:group 'circe)
(defcustom circe-use-cycle-completion nil
"Whether Circe should use cycle completion.
If this is not nil, Circe will set `completion-cycle-threshold'
to t locally in Circe buffers, enabling cycle completion for
nicks no matter what completion style you use in the rest of
Emacs. If you set this to nil, Circe will not touch your default
completion style."
:type 'boolean
:group 'circe)
(defcustom circe-reduce-lurker-spam nil
"If enabled, Circe will stop showing some messages.
This means that JOIN, PART, QUIT and NICK messages are not shown
for users on channels that have not spoken yet (\"lurker\"), or
haven't spoken in `circe-active-users-timeout' seconds. When they
speak for the first time, Circe displays their join time."
:type 'boolean
:group 'circe)
(defcustom circe-active-users-timeout nil
"When non-nil, should be the number of seconds after which
active users are regarded as inactive again after speaking."
:type 'integer
:group 'circe)
(defcustom circe-prompt-string (concat (propertize ">"
'face 'circe-prompt-face)
" ")
"The string to initialize the prompt with.
To change the prompt dynamically or just in specific buffers, use
`lui-set-prompt' in the appropriate hooks."
:type 'string
:group 'circe)
(defcustom circe-extra-nicks nil
"List of other nicks than your current one to highlight."
:type '(repeat string)
:group 'circe)
(defcustom circe-highlight-nick-type 'sender
"How to highlight occurrences of our own nick.
'sender - Highlight the nick of the sender
(messages without a sender and your
own are highlighted with the occurrence
type instead)
'occurrence - Highlight the occurrences of the nick
'message - Highlight the message without the sender
'all - Highlight the whole line"
:type '(choice (const :tag "Sender" sender)
(const :tag "Occurrences" occurrence)
(const :tag "Message" message)
(const :tag "Whole line" all))
:group 'circe)
(defcustom circe-inhibit-nick-highlight-function nil
"Function for inhibiting nick highlighting.
If non-nil, its value is called with the respective buffer
selected and point in the line that's about to get highlighted.
A non-nil return value inhibits any highlighting."
:type '(choice (const :tag "None" nil)
function)
:group 'circe)
(defcustom circe-completion-suffix ": "
"A suffix for completed nicks at the beginning of a line."
:type '(choice (const :tag "The standard suffix" ": "))
:group 'circe)
(defcustom circe-ignore-list nil
"List of regular expressions to ignore.
Each regular expression is matched against nick!user@host."
:type '(repeat regexp)
:group 'circe)
(defcustom circe-fool-list nil
"List of regular expressions for fools.
Each regular expression is matched against nick!user@host.
Messages from such people are still inserted, but not shown. They
can be displayed using \\[lui-toggle-ignored]."
:type '(repeat regexp)
:group 'circe)
(defcustom circe-ignore-functions nil
"A list of functions to check whether we should ignore a message.
These functions get five arguments: NICK, USERHOST, and BODY. If
one of them returns a non-nil value, the message is ignored."
:type 'hook
:group 'circe)
(defcustom circe-split-line-length 440
"The maximum length of a single message.
If a message exceeds this size, it is broken into multiple ones.
IRC allows for lines up to 512 bytes. Two of them are CR LF.
And a typical message looks like this:
:[email protected] PRIVMSG #lazybastards :Hello!
You can limit here the maximum length of the \"Hello!\" part.
Good luck."
:type 'integer
:group 'circe)
(defcustom circe-server-max-reconnect-attempts 5
"How often Circe should attempt to reconnect to the server.
If this is 0, Circe will not reconnect at all. If this is nil,
it will try to reconnect forever (not recommended)."
:type 'integer
:group 'circe)
(defcustom circe-netsplit-delay 60
"The number of seconds a netsplit may be dormant.
If anything happens with a netsplit after this amount of time,
the user is re-notified."
:type 'number
:group 'circe)
(defcustom circe-server-killed-confirmation 'ask
"How to ask for confirmation when a server buffer is killed.
This can be one of the following values:
ask - Ask the user for confirmation
ask-and-kill-all - Ask the user, and kill all associated buffers
nil - Kill first, ask never"
:type '(choice (const :tag "Ask before killing" ask)
(const :tag "Ask, then kill all associated buffers"
ask-and-kill-all)
(const :tag "Don't ask" nil))
:group 'circe)
(defcustom circe-channel-killed-confirmation 'ask
"How to ask for confirmation when a channel buffer is killed.
This can be one of the following values:
ask - Ask the user for confirmation
nil - Don't ask, just kill"
:type '(choid (const :tag "Ask before killing" ask)
(const :tag "Don't ask" nil))
:group 'circe)
(defcustom circe-track-faces-priorities '(circe-highlight-nick-face
lui-highlight-face
circe-my-message-face
circe-server-face)
"A list of faces which should show up in the tracking.
The first face is kept if the new message has only lower faces,
or faces that don't show up at all."
:type '(repeat face)
:group 'circe)
(defcustom circe-server-send-unknown-command-p nil
"Non-nil when Circe should just pass on commands it doesn't know.
E.g. /fnord foo bar would then just send \"fnord foo bar\" to the
server."
:type 'boolean
:group 'circe)
(defcustom circe-server-connected-hook nil
"Hook run when we successfully connected to a server.
This is run from a 001 (RPL_WELCOME) message handler."
:type 'hook
:group 'circe)
(defcustom circe-server-auto-join-default-type :immediate
"The default auto-join type to use.
Possible options:
:immediate - Immediately after registering on the server
:after-auth - After nickserv authentication succeeded
:after-cloak - After we have acquired a cloaked host name
:after-nick - After we regained our preferred nick, or after
nickserv authentication if we don't need to regain
it. See `circe-nickserv-ghost-style'.
See `circe-channels' for more details."
:type '(choice (const :tag "Immediately" :immediate)
(const :tag "After Authentication" :after-auth)
(const :tag "After Cloaking" :after-cloak)
(const :tag "After Nick Regain" :after-nick))
:group 'circe)
;;;;;;;;;;;;;;;;;
;;;; Formats ;;;;
;;;;;;;;;;;;;;;;;
(defgroup circe-format nil
"Format strings for Circe.
All these formats always allow the {mynick} and {chattarget} format
strings."
:prefix "circe-format-"
:group 'circe)
(defcustom circe-format-not-tracked
'(circe-format-server-message
circe-format-server-notice
circe--irc-format-server-numeric
circe-format-server-topic
circe-format-server-rejoin
circe-format-server-lurker-activity
circe-format-server-topic-time
circe-format-server-topic-time-for-channel
circe-format-server-netmerge
circe-format-server-join
circe-format-server-join-in-channel
circe-format-server-mode-change
circe-format-server-nick-change-self
circe-format-server-nick-change
circe-format-server-nick-regain
circe-format-server-part
circe-format-server-netsplit
circe-format-server-quit-channel
circe-format-server-quit)
"A list of formats that should not trigger tracking."
:type '(repeat symbol)
:group 'circe-format)
(defcustom circe-format-server-message "*** {body}"
"The format for generic server messages.
{body} - The body of the message."
:type 'string
:group 'circe-format)
(defcustom circe-format-self-say "> {body}"
"The format for messages to queries or channels.
{nick} - Your nick.
{body} - The body of the message."
:type 'string
:group 'circe-format)
(defcustom circe-format-self-action "* {nick} {body}"
"The format for actions to queries or channels.
{nick} - Your nick.
{body} - The body of the action."
:type 'string
:group 'circe-format)
(defcustom circe-format-self-message "-> *{chattarget}* {body}"
"The format for messages sent to other people outside of queries.
{chattarget} - The target nick.
{body} - The body of the message."
:type 'string
:group 'circe-format)
(defcustom circe-format-action "* {nick} {body}"
"The format for actions in queries or channels.
{nick} - The nick doing the action.
{body} - The body of the action."
:type 'string
:group 'circe-format)
(defcustom circe-format-message-action "* *{nick}* {body}"
"The format for actions in messages outside of queries.
{nick} - The nick doing the action.
{body} - The body of the action."
:type 'string
:group 'circe-format)
(defcustom circe-format-say "<{nick}> {body}"
"The format for normal channel or query talk.
{nick} - The nick talking.
{body} - The message."
:type 'string
:group 'circe-format)
(defcustom circe-format-message "*{nick}* {body}"
"The format for a message outside of a query.
{nick} - The originator.
{body} - The message."
:type 'string
:group 'circe-format)
(defcustom circe-format-notice "-{nick}- {body}"
"The format for a notice.
{nick} - The originator.
{body} - The notice."
:type 'string
:group 'circe-format)
(defcustom circe-format-server-notice "-Server Notice- {body}"
"The format for a server notice.
{body} - The notice."
:type 'string
:group 'circe-format)
(defcustom circe-format-server-topic "*** Topic change by {nick} ({userhost}): {new-topic}"
"The format for topic changes.
The following format arguments are available:
nick - The nick of the user who changed the topic
userhost - The user@host string of that user
channel - Where the topic change happened
new-topic - The new topic
old-topic - The previous topic
topic-diff - A colorized diff of the topics"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-lurker-activity
"*** First activity: {nick} joined {joindelta} ago."
"The format for the first-activity notice of a user.
{nick} - The originator.
{jointime} - The join time of the user (in seconds).
{joindelta} - The duration from joining until now."
:type 'string
:group 'circe-format)
(defcustom circe-format-server-rejoin
"*** Re-join: {nick} ({userinfo}), left {departuredelta} ago"
"The format for the re-join notice of a user.
The following format arguments are available:
nick - The nick of the user who joined
userhost - The user@host string of the user who joined
accountname - The account name, if the server supports this
realname - The real name, if the server supports this
userinfo - A combination of userhost, accountname, and realname
channel - A date string describing this time
departuretime - Time in seconds when the originator had left.
departuredelta - Description of the time delta since the originator left."
:type 'string
:group 'circe-format)
(defcustom circe-server-buffer-name "{host}:{port}"
"The format for the server buffer name.
The following format arguments are available:
network - The name of the network
host - The host name of the server
port - The port number or service name
service - Alias for port"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-whois-idle-with-signon "*** {whois-nick} is {idle-duration} idle (signon on {signon-date}, {signon-ago} ago)"
"Format for RPL_WHOISIDLE messages.
The following format arguments are available:
whois-nick - The nick this is about
idle-seconds - The number of seconds this nick has been idle
idle-duration - A textual description of the duration of the idle time
signon-time - The time (in seconds since the epoch) when this user
signed on
signon-date - A date string describing this time
signon-ago - A textual description of the duraction since signon"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-whois-idle "*** {whois-nick} is {idle-duration} idle"
"Format for RPL_WHOISIDLE messages.
The following format arguments are available:
whois-nick - The nick this is about
idle-seconds - The number of seconds this nick has been idle
idle-duration - A textual description of the duration of the idle time"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-topic-time "*** Topic set by {setter} on {topic-date}, {topic-ago} ago"
"Format for RPL_TOPICWHOTIME messages for the current channel.
The following format arguments are available:
channel - The channel the topic is for
setter - The nick of the person who set the topic
setter-userhost - The user@host string of the person who set the topic
topic-time - The time the topic was set, in seconds since the epoch
topic-date - A date string describing this time
topic-ago - A textual description of the duration since the topic
was set"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-topic-time-for-channel "*** Topic for {channel} set by {setter} on {topic-date}, {topic-ago} ago"
"Format for RPL_TOPICWHOTIME messages for a channel we are not on.
The following format arguments are available:
channel - The channel the topic is for
setter - The nick of the person who set the topic
setter-userhost - The user@host string of the person who set the topic
topic-time - The time the topic was set, in seconds since the epoch
topic-date - A date string describing this time
topic-ago - A textual description of the duration since the topic
was set"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-channel-creation-time "*** Channel {channel} created on {date}, {ago} ago"
"Format for RPL_CREATIONTIME messages for the current channel.
The following format arguments are available:
channel - The channel the topic is for
date - A date string describing this time
ago - A textual description of the duration since the channel
was created"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-ctcp-ping "*** CTCP PING request from {nick} ({userhost}) to {target}: {body} ({ago} ago)"
"Format for CTCP PING requests.
The following format arguments are available:
nick - The nick of the user who sent this PING request
userhost - The user@host string of the user who sent this request
target - The target of the message, usually us, but can be a channel
body - The argument of the PING request, usually a number
ago - A textual description of the duration since the request
was sent, if parseable"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-ctcp-ping-reply "*** CTCP PING reply from {nick} ({userhost}) to {target}: {ago} ago ({body})"
"Format for CTCP PING replies.
The following format arguments are available:
nick - The nick of the user who sent this PING request
userhost - The user@host string of the user who sent this request
target - The target of the message, usually us, but can be a channel
body - The argument of the PING request, usually a number
ago - A textual description of the duration since the request
was sent, if parseable"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-ctcp "*** CTCP {command} request from {nick} ({userhost}) to {target}: {body}"
"Format for CTCP requests.
The following format arguments are available:
nick - The nick of the user who sent this PING request
userhost - The user@host string of the user who sent this request
target - The target of the message, usually us, but can be a channel
command - The CTCP command used
body - The argument of the PING request, usually a number"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-netsplit "*** Netsplit: {split} (Use /WL to see who left)"
"Format for netsplit notifications.
The following format arguments are available:
split - The name of the split, usually describing the servers involved"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-netmerge "*** Netmerge: {split}, split {ago} ago (Use /WL to see who's still missing)"
"Format for netmerge notifications.
The following format arguments are available:
split - The name of the split, usually describing the servers involved
time - The time when this split happened, in seconds
date - A date string describing this time
ago - A textual description of the duration since the split happened"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-join "*** Join: {nick} ({userinfo})"
"Format for join messages in a channel buffer.
The following format arguments are available:
nick - The nick of the user joining
userhost - The user@host string for the user
accountname - The account name, if the server supports this
realname - The real name, if the server supports this
userinfo - A combination of userhost, accountname, and realname
channel - The channel this user is joining"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-join-in-channel "*** Join: {nick} ({userinfo}) joined {channel}"
"Format for join messages in query buffers of the joining user.
The following format arguments are available:
nick - The nick of the user joining
userhost - The user@host string for the user
accountname - The account name, if the server supports this
realname - The real name, if the server supports this
userinfo - A combination of userhost, accountname, and realname
channel - The channel this user is joining"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-mode-change "*** Mode change: {change} on {target} by {setter} ({userhost})"
"Format for mode changes.
The following format arguments are available:
setter - The name of the split, usually describing the servers involved
userhost - The user@host string for the user
target - The target of this mode change
change - The actual changed modes"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-nick-change-self "*** Nick change: You are now known as {new-nick}"
"Format for nick changes of the current user.
The following format arguments are available:
old-nick - The old nick this change was from
new-nick - The new nick this change was to
userhost - The user@host string for the user"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-nick-change "*** Nick change: {old-nick} ({userhost}) is now known as {new-nick}"
"Format for nick changes of the current user.
The following format arguments are available:
old-nick - The old nick this change was from
new-nick - The new nick this change was to
userhost - The user@host string for the user"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-nick-regain "*** Nick regain: {old-nick} ({userhost}) is now known as {new-nick}"
"Format for nick changes of the current user.
The following format arguments are available:
old-nick - The old nick this change was from
new-nick - The new nick this change was to
userhost - The user@host string for the user"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-part "*** Part: {nick} ({userhost}) left {channel}: {reason}"
"Format for users parting a channel.
The following format arguments are available:
nick - The nick of the user who left
userhost - The user@host string for this user
channel - The channel they left
reason - The reason they gave for leaving"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-quit-channel "*** Quit: {nick} ({userhost}) left {channel}: {reason}"
"Format for users quitting from a channel.
The following format arguments are available:
nick - The nick of the user who left
userhost - The user@host string for this user
channel - The channel they left
reason - The reason they gave for leaving"
:type 'string
:group 'circe-format)
(defcustom circe-format-server-quit "*** Quit: {nick} ({userhost}) left IRC: {reason}"
"Format for users quitting.
The following format arguments are available:
nick - The nick of the user who left
userhost - The user@host string for this user
reason - The reason they gave for leaving"
:type 'string
:group 'circe-format)
;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Private variables ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar circe-source-url "https://github.com/jorgenschaefer/circe"
"URL to Circe's source repository")
(defvar circe-host nil
"The name of the server we're currently connected to.")
(make-variable-buffer-local 'circe-host)
(defvar circe-port nil
"The port number or service name of the server.")
(make-variable-buffer-local 'circe-host)
(defvar circe-network nil
"The network name of the server we're currently connected to.")
(make-variable-buffer-local 'circe-network)
(defvar circe-ip-family nil
"The IP family in use.
See `make-network-process' and :family for valid values.")
(make-variable-buffer-local 'circe-ip-family)
(defvar circe-nick nil
"Our current nick.")
(make-variable-buffer-local 'circe-nick)
(defvar circe-user nil
"The current user name.")
(make-variable-buffer-local 'circe-user)
(defvar circe-realname nil
"The current real name.")
(make-variable-buffer-local 'circe-realname)
(defvar circe-pass nil
"The password for the current server or a function to recall it.
If a function is set it will be called with the value of `circe-host'.")
(make-variable-buffer-local 'circe-pass)
(defvar circe-sasl-username nil
"The username for SASL authentication.")
(make-variable-buffer-local 'circe-sasl-username)
(defvar circe-sasl-password nil
"The password for SASL authentication.
If a function is set it will be called with the value of
`circe-host'.")
(make-variable-buffer-local 'circe-sasl-password)
(defvar circe-use-tls nil
"If non-nil, use `open-tls-stream' to connect to the server.")
(make-variable-buffer-local 'circe-use-tls)
(defvar circe-server-process nil
"The process of the server connection.")
(make-variable-buffer-local 'circe-server-process)
(defvar circe-server-last-active-buffer nil
"The last active circe buffer.")
(make-variable-buffer-local 'circe-server-last-active-buffer)
(defvar circe-display-table nil
"A hash table mapping commands to their display functions.")
(defvar circe-server-inhibit-auto-reconnect-p nil
"Non-nil when Circe should not reconnect.
This can be set from commands to avoid reconnecting when the
server disconnects.")
(make-variable-buffer-local 'circe-server-inhibit-auto-reconnect-p)
(defvar circe-chat-calling-server-buffer-and-target nil
"Internal variable to pass the server buffer and target to chat modes.")
(defvar circe-chat-target nil
"The current target for the buffer.
This is either a channel or a nick name.")
(make-variable-buffer-local 'circe-chat-target)
(defvar circe-nick-syntax-table
(let ((table (make-syntax-table text-mode-syntax-table))
(special (string-to-list "[]\`_^{}|-")))
(dolist (char special)
(modify-syntax-entry char "w" table))
table)
"Syntax table to treat nicks as words.
This is not entirely accurate, as exact chars constituting a nick
can vary between networks.")
(defvar circe-nickserv-mask nil
"The regular expression to identify the nickserv on this network.
Matched against nick!user@host.")
(make-variable-buffer-local 'circe-nickserv-mask)
(defvar circe-nickserv-identify-challenge nil
"A regular expression matching the nickserv challenge to identify.")
(make-variable-buffer-local 'circe-nickserv-identify-challenge)
(defvar circe-nickserv-identify-command nil
"The IRC command to send to identify with nickserv.
This must be a full IRC command. It accepts the following
formatting options:
{nick} - The nick to identify as
{password} - The configured nickserv password")
(make-variable-buffer-local 'circe-nickserv-identify-command)
(defvar circe-nickserv-identify-confirmation nil
"A regular expression matching a confirmation of authentication.")
(make-variable-buffer-local 'circe-nickserv-identify-confirmation)
(defvar circe-nickserv-ghost-command nil
"The IRC command to send to regain/ghost your nick.
This must be a full IRC command. It accepts the following
formatting options:
{nick} - The nick to ghost
{password} - The configured nickserv password")
(make-variable-buffer-local 'circe-nickserv-ghost-command)
(defvar circe-nickserv-ghost-confirmation nil
"A regular expression matching a confirmation for the GHOST command.
This is used to know when we can set our nick to the regained one
Leave nil if regaining automatically sets your nick")
(make-variable-buffer-local 'circe-nickserv-ghost-confirmation)
(defvar circe-nickserv-nick nil
"The nick we are registered with for nickserv.
Do not set this variable directly. Use `circe-network-options' or
pass an argument to the `circe' function for this.")
(make-variable-buffer-local 'circe-nickserv-nick)
(defvar circe-nickserv-password nil
"The password we use for nickserv on this network.
Can be either a string or a unary function of the nick returning
a string.
Do not set this variable directly. Use `circe-network-options' or
pass an argument to the `circe' function for this.")
(make-variable-buffer-local 'circe-nickserv-password)
(defvar circe-channels nil
"The default channels to join on this server.
Don't set this variable by hand, use `circe-network-options'.
The value should be a list of channels to join, with optional
keywords to configure the behavior of the following channels.
Best explained in an example:
\(\"#emacs\" :after-auth \"#channel\" \"#channel2\")
Possible keyword options are:
:immediate - Immediately after registering on the server
:after-auth - After nickserv authentication succeeded
:after-cloak - After we have acquired a cloaked host name
:after-nick - After we regained our preferred nick, or after
nickserv authentication if we don't need to regain
it. See `circe-nickserv-ghost-style'.
The default is set in `circe-server-auto-join-default-type'.
A keyword in the first position of the channels list overrides
`circe-server-auto-join-default-type' for re-joining manually
joined channels.")
(make-variable-buffer-local 'circe-channels)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Server Buffer Management ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Every Circe buffer has an associated server buffer (which might be
;; the buffer itself). Circe buffers should set the
;; `circe-server-buffer' variable to the associated server buffer.
(defun circe-server-buffer ()
"Return the server buffer for the current buffer."