-
Notifications
You must be signed in to change notification settings - Fork 0
/
irchat-handle.el
697 lines (654 loc) · 23.2 KB
/
irchat-handle.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
;;; -*- emacs-lisp -*-
;;;
;;; see file irchat-copyright.el for change log and copyright info
(eval-when-compile (require 'irchat-inlines))
(eval-and-compile
(require 'irchat-vars)
(require 'irchat-filter))
(defun irchat-handle-error-msg (parsed-sender parsed-msg prefix rest)
(message "IRC error: %s" rest))
(defun irchat-ifrest (rest &optional quote)
(if (= 0 (length rest))
""
(if quote
(regexp-quote (format " (%s)" rest))
(format " (%s)" rest))))
(defun irchat-handle-channel-msg (parsed-sender parsed-msg prefix rest)
(let ((ispart (string= rest "0")))
(if (string= prefix irchat-real-nickname)
(progn
(setq irchat-current-channel rest)
(setq irchat-channel-indicator
(if ispart
"No channel"
(format "Channel %s" rest)))
(irchat-set-crypt-indicator)))
(if ispart
(if (not irchat-ignore-changes)
(irchat-w-insert irchat-D-buffer
(format "%s%s has left this channel\n"
irchat-change-prefix prefix)))
(if (not irchat-ignore-changes)
(irchat-w-insert irchat-D-buffer
(format "%s%s has joined this channel\n"
irchat-change-prefix prefix))))
(irchat-change-nick-of prefix prefix)))
(defun irchat-handle-nick-msg (parsed-sender parsed-msg prefix rest)
(irchat-change-nick-of prefix rest)
(put (intern rest irchat-obarray) 'chnl
(get (intern prefix irchat-obarray) 'chnl))
(put (intern prefix irchat-obarray) 'chnl nil)
(if (string= prefix irchat-real-nickname)
(setq irchat-real-nickname rest))
(irchat-w-insert irchat-D-buffer
(format "%s%s is now known as %s\n"
irchat-change-prefix prefix rest)))
(defun irchat-handle-notice-msg (parsed-sender parsed-msg prefix rest)
(if (and irchat-shorten-kills
(string-match
"Notice[: -]*Received KILL message for \\([^.]*\\)\\. From \\([^ ]*\\) Path: \\([^ ]*\\) ?\\(.*\\)"
rest))
(let ((killed (matching-substring rest 1))
(killer (matching-substring rest 2))
(reason (matching-substring rest 4))
(buf (current-buffer)))
(set-buffer irchat-KILLS-buffer)
(goto-char (point-max))
(irchat-w-insert irchat-K-buffer
(format "%s\n" rest))
(set-buffer buf)
(irchat-w-insert irchat-D-buffer
(format "%s%s KILLed %s %s\n"
irchat-notice-prefix
killer killed
(if (= (length reason) 0)
"-No reason supplied-"
reason))))
(let* ((msg-encrypted-p nil)
(msg-suspicious-p nil)
(msg-garbled-p nil)
(msg-fingerprint nil)
(msg-timestamp nil)
(rest (if (string-match "^\\([^:][^:]*:\\)\\(.*\\)$" rest)
(let ((head (matching-substring rest 1))
(tail (matching-substring rest 2)))
(if (irchat-encrypted-message-p tail)
(let* ((clear (irchat-decrypt-message tail))
(stat (nth 0 clear)) ;; 'success or 'error
(nick (nth 1 clear)) ;; sender's nick
(time (nth 2 clear)) ;; timestamp
(msg (nth 3 clear)) ;; cleartext msg
(fprint (nth 4 clear)) ;; fingerprint
(warn ""))
(setq msg-encrypted-p t)
(setq msg-fingerprint fprint)
(setq msg-timestamp time)
;;; Check timestamp and nick here
(if (and (equal 'success stat)
(not (irchat-hex-timestamp-valid
time
irchat-crypt-timestamp-tolerance)))
(progn
(setq msg-suspicious-p t)
(setq warn
(concat warn
" [Invalid timestamp!]"))))
(if (and (equal 'success stat)
(not (string-ci-equal nick
prefix)))
(progn
(setq msg-suspicious-p t)
(setq warn
(concat warn
(format
" [Invalid sender \"%s\" != \"%s\"]"
nick
prefix)))))
(if (not (equal 'success stat))
(progn
(setq msg-garbled-p t)
(irchat-w-insert irchat-C-buffer
(format "-%s- %s [%s]\n"
prefix
tail
msg))))
(concat head (format "%s%s" msg warn)))
rest))
rest)))
(if (or (not irchat-ignore-extra-notices)
(not prefix)
(not (string-match "as being away" rest)))
(if (let ((irchat-current-message-encrypted-p msg-encrypted-p)
(irchat-current-message-suspicious-p msg-suspicious-p)
(irchat-current-message-fingerprint msg-fingerprint)
(irchat-current-message-timestamp msg-timestamp))
(irchat-run-message-hook-types 'irchat-notice-cleartext-hook
prefix
rest))
nil
(if prefix
(cond
; prefixed clt-a-notice
((string-match "\\(.*\\)" rest)
(irchat-ctl-a-notice prefix rest))
((and irchat-ignore-fakes
(string-match ".*Notice.*Fake:.*" rest))
t)
; not a clt-a, but notice
((string-match ".*Notice -- \\(.*\\)" rest)
(irchat-w-insert irchat-D-buffer
(format "%s%s: %s\n"
irchat-notice-prefix
prefix
(matching-substring rest 1))))
; else send user a private message
(t
(irchat-handle-privmsglike-msg parsed-sender parsed-msg prefix rest msg-encrypted-p)))
(progn
;; no prefix
(string-match "^\\([^ ]*\\) :\\(.*\\)" rest)
(irchat-w-insert irchat-D-buffer
(format "%s%s\n"
irchat-notice-prefix
(matching-substring rest 2))))))))))
(defun irchat-handle-ping-msg (parsed-sender parsed-msg prefix rest)
(if (string-match "^\\([^ ][^ ]*\\)" rest)
(irchat-send "PONG %s: %s"
irchat-real-nickname
(matching-substring rest 1))
(irchat-send "PONG yourself"))
(irchat-Command-timestamp-if-interval-expired t)
(irchat-maybe-poll))
(defun irchat-handle-pong-msg (parsed-sender parsed-msg prefix rest)
())
;; Is this still needed?
(defun irchat-handle-msg-msg (parsed-sender parsed-msg prefix rest)
(irchat-nick-to-uah-append prefix irchat-userathost irchat-userathost-type)
(if (or (and prefix
(irchat-ignore-this-p prefix irchat-userathost)
(irchat-msg-from-ignored prefix rest))
(and (not prefix)
(string= "> " rest)))
nil
(if prefix
(let ((oma (get (intern prefix irchat-obarray) 'chnl)))
(if oma
(while (or (string= "#" (substring (car oma) 0 1))
(string= "&" (substring (car oma) 0 1)))
(setq oma (cdr oma)))
(setq oma (list irchat-current-channel)))
(if (string= (car oma) irchat-current-channel)
(irchat-w-insert
irchat-D-buffer
(format "%s %s\n"
(format (irchat-format-string 2 nil) prefix)
rest))
(irchat-w-insert
irchat-D-buffer
(format "%s %s\n"
(format (irchat-format-string 3 nil) prefix (car oma))
rest)))))))
(defun irchat-handle-privmsg-msg (parsed-sender parsed-msg prefix rest)
(irchat-nick-to-uah-append prefix irchat-userathost irchat-userathost-type)
(if (and prefix
(irchat-ignore-this-p prefix irchat-userathost)
(irchat-msg-from-ignored prefix rest))
nil
(string-match "^\\([^ ]+\\) :\\(.*\\)" rest)
(let* ((msg-encrypted-p nil)
(msg-suspicious-p nil)
(msg-garbled-p nil)
(msg-fingerprint nil)
(msg-timestamp nil)
(chnl (matching-substring rest 1))
(temp (matching-substring rest 2))
(case-fold-search t)
(temp (if (not (irchat-encrypted-message-p temp))
(progn
(setq msg-encrypted-p nil)
temp)
(let* ((clear (irchat-decrypt-message temp))
(stat (nth 0 clear)) ;; 'success or 'error
(nick (nth 1 clear)) ;; sender's nick (string)
(time (nth 2 clear)) ;; timestamp (hex-string)
(msg (nth 3 clear)) ;; cleartext msg (string)
(fprint (nth 4 clear)) ;; fingerprint (string)
(warn ""))
(setq msg-encrypted-p t)
(setq msg-fingerprint fprint)
(setq msg-timestamp time)
;;; Check timestamp and nick here
(if (and (equal 'success stat)
(not (irchat-hex-timestamp-valid
time
irchat-crypt-timestamp-tolerance)))
(progn
(setq msg-suspicious-p t)
(setq warn (concat warn " [Invalid timestamp!]"))))
(if (and (equal 'success stat)
(not (string-ci-equal nick
prefix)))
(progn
(setq msg-suspicious-p t)
(setq warn
(concat warn (format
" [Invalid sender \"%s\" != \"%s\"]"
nick
prefix)))))
(if (not (equal 'success stat))
(progn
(setq msg-garbled-p t)
(irchat-w-insert irchat-C-buffer
(format "<%s -> %s> %s [%s]\n"
prefix
chnl
temp
msg))))
(format "%s%s" msg warn)))))
(if (and msg-encrypted-p
msg-garbled-p
irchat-crypt-ignore-defected)
(irchat-msg-from-ignored prefix (concat chnl " :" temp))
(if (and msg-encrypted-p
msg-suspicious-p
irchat-crypt-ignore-suspicious)
(irchat-msg-from-ignored prefix (concat chnl " :" temp))
(if (let ((irchat-current-message-encrypted-p msg-encrypted-p)
(irchat-current-message-suspicious-p msg-suspicious-p)
(irchat-current-message-fingerprint msg-fingerprint)
(irchat-current-message-timestamp msg-timestamp))
(irchat-run-message-hook-types 'irchat-privmsg-cleartext-hook
prefix
(concat chnl
" :"
temp)))
nil
(let ((x-prefix (cond ((and msg-encrypted-p
msg-suspicious-p)
irchat-suspicious-message-prefix)
((and msg-encrypted-p
msg-garbled-p)
irchat-defected-message-prefix)
(t ""))))
(if (string-match "\\(.*\\)" temp)
(setq temp (irchat-ctl-a-msg prefix chnl temp)))
(if (not (string= temp ""))
(if (and prefix
(irchat-ignore-this-p prefix irchat-userathost temp)
(irchat-msg-from-ignored prefix rest))
(irchat-msg-from-ignored prefix rest)
(progn
;; only private messages to us get time-stamp
(if (and (string-equal "A" irchat-away-indicator)
(string-ci-equal chnl irchat-real-nickname))
(setq temp (format "%s (%s)" temp
(if irchat-format-time-function
(apply irchat-format-time-function
(list (current-time-string)))
(current-time-string)))))
(cond
((string-ci-equal chnl irchat-real-nickname)
(irchat-Dialogue-insert-message
irchat-P-buffer
x-prefix
(irchat-format-string 1 msg-encrypted-p)
prefix
temp))
((string-ci-equal chnl (or irchat-current-channel ""))
(if (irchat-user-on-this-channel prefix chnl)
(irchat-Dialogue-insert-message
(irchat-pick-buffer chnl)
x-prefix
(irchat-format-string 2 msg-encrypted-p)
prefix
temp)
(irchat-Dialogue-insert-message
(irchat-pick-buffer chnl)
x-prefix
(irchat-format-string 4 msg-encrypted-p)
prefix
temp)))
(t;; channel we are joined (not current)
(if (irchat-user-on-this-channel prefix chnl)
(irchat-Dialogue-insert-message
(irchat-pick-buffer chnl)
x-prefix
(irchat-format-string 3 msg-encrypted-p)
prefix
temp
chnl)
(irchat-Dialogue-insert-message
(irchat-pick-buffer chnl)
x-prefix
(irchat-format-string 5 msg-encrypted-p)
prefix
temp
chnl))))
(or (irchat-get-buffer-window (current-buffer))
(not (string-ci-equal chnl irchat-real-nickname))
(message "IRCHAT: A private message has arrived from %s" prefix))))))))))))
;; NOTICE
(defun irchat-handle-privmsglike-msg (parsed-sender parsed-msg prefix rest &optional msg-encrypted-p)
(if (and prefix
(irchat-ignore-this-p prefix irchat-userathost)
(irchat-msg-from-ignored prefix rest))
nil
(irchat-nick-to-uah-append prefix irchat-userathost irchat-userathost-type)
(string-match "^\\([^ ]+\\) :\\(.*\\)" rest)
(let ((chnl (matching-substring rest 1))
(temp (matching-substring rest 2))
(case-fold-search t)
(x-prefix (cond ((and (boundp 'msg-encrypted-p)
msg-encrypted-p
(boundp 'msg-suspicious-p)
msg-suspicious-p)
irchat-suspicious-message-prefix)
((and (boundp 'msg-encrypted-p)
msg-encrypted-p
(boundp 'msg-garbled-p)
msg-garbled-p)
irchat-defected-message-prefix)
(t ""))))
(if (string-match "\\(.*\\)" temp)
(setq temp (irchat-ctl-a-msg prefix chnl temp)))
(if (not (string= temp ""))
(if (and prefix
(irchat-ignore-this-p prefix irchat-userathost temp)
(irchat-msg-from-ignored prefix rest))
(irchat-msg-from-ignored prefix rest)
(cond
((string-ci-equal chnl irchat-real-nickname)
(irchat-w-insert irchat-D-buffer
(format "%s%s %s\n"
x-prefix
(format
(irchat-format-string
0
msg-encrypted-p)
prefix)
temp)))
((string-ci-equal chnl (or irchat-current-channel ""))
(if (irchat-user-on-this-channel prefix chnl)
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%s %s\n"
x-prefix
(format
(irchat-format-string
2
msg-encrypted-p)
prefix)
temp))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%s %s\n"
x-prefix
(format
(irchat-format-string
4
msg-encrypted-p)
prefix)
temp))))
(t;; channel we are joined (not current)
(if (irchat-user-on-this-channel prefix chnl)
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%s %s\n"
x-prefix
(format
(irchat-format-string
3
msg-encrypted-p)
prefix chnl)
temp))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%s %s\n"
x-prefix
(format
(irchat-format-string
5
msg-encrypted-p)
prefix chnl)
temp))))))))))
(defun irchat-handle-wall-msg (parsed-sender parsed-msg prefix rest)
"Handle the WALL message."
(irchat-w-insert irchat-D-buffer
(format "%s%s %s\n"
irchat-broadcast-prefix
(if prefix (concat "from " prefix) "") rest)))
(defun irchat-handle-wallops-msg (parsed-sender parsed-msg prefix rest)
"Handle the WALLOPS message."
(if irchat-show-wallops
(irchat-w-insert irchat-D-buffer
(format "%s%s: %s\n"
irchat-wallops-prefix
(if prefix prefix "UNKNOWN") rest)))
(let ((buf (current-buffer)))
(set-buffer irchat-WALLOPS-buffer)
(goto-char (point-max))
(irchat-w-insert irchat-W-buffer
(format "%s%s %s\n"
irchat-wallops-prefix
(if prefix
(concat "from " prefix) "")
rest))
(set-buffer buf)))
(defun irchat-handle-quit-msg (parsed-sender parsed-msg prefix rest)
"Handle the QUIT message."
(if (and (not irchat-ignore-changes)
(or (not irchat-ignore-changes-from-ignored)
(not (irchat-ignore-this-p prefix irchat-userathost))))
(if irchat-compress-changes
(let* ((text (format " \\(has\\|have\\) left IRC%s"
(irchat-ifrest rest t)))
(match (format "^%s.*%s$"
(regexp-quote irchat-change-prefix) text))
(default (format "%s%s has left IRC%s\n"
irchat-change-prefix
prefix
(irchat-ifrest rest))))
(irchat-w-replace irchat-D-buffer
match default text
(format ", %s have left IRC%s"
prefix (irchat-ifrest rest))))
(irchat-w-insert irchat-D-buffer
(format "%s%s has left IRC%s\n"
irchat-change-prefix
prefix
(irchat-ifrest rest)))))
(irchat-change-nick-of prefix nil))
(defun irchat-handle-topic-msg (parsed-sender parsed-msg prefix rest)
"Handle the TOPIC message."
(if (string-match "\\([^ :]*\\)[: ]*\\(.*\\)" rest)
(let ((chnl (matching-substring rest 1))
(topic (matching-substring rest 2)))
(if (not irchat-ignore-changes)
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%sNew topic on channel %s set by %s: %s\n"
irchat-change-prefix chnl prefix topic))))
(message "IRCHAT: Strange TOPIC")))
(defun irchat-handle-mode-msg (parsed-sender parsed-msg prefix rest)
"Handle the MODE message."
(if (and (not irchat-ignore-changes)
(or (not irchat-ignore-changes-from-ignored)
(not (irchat-ignore-this-p prefix irchat-userathost))))
(let ((chnl " ")
(str "")
(server-change (if (string-match "..*\\...*" prefix) t nil)))
(if (or (and (string-match "\\([^ ]*\\) :*\\(.*\\)" rest)
(setq chnl (matching-substring rest 1)
str (matching-substring rest 2)
str (if (= (aref str (1- (length str))) 32)
(substring str 0 -1) str)))
(and (string-match " :\\(.*\\)" rest)
(setq str (matching-substring rest 1))))
(if irchat-compress-changes
(if server-change
(let* ((default (format "%sNew mode for %s set by %s: %s\n"
irchat-change-prefix
chnl
prefix
str)))
'())
(let* ((text (format "\n" rest))
(match (format "^%sNew mode for %s set by %s: "
(regexp-quote irchat-change-prefix)
chnl
prefix))
(default (format "%sNew mode for %s set by %s: %s\n"
irchat-change-prefix
chnl
prefix
str)))
(irchat-w-replace (irchat-pick-buffer chnl)
match
default
text
(format ", %s\n" str))))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%sNew mode for %s set by %s: %s\n"
irchat-change-prefix
chnl
prefix
str)))
(message "IRCHAT: Strange MODE")))))
(defun irchat-handle-kick-msg (parsed-sender parsed-msg prefix rest)
"Handle the KICK message."
(if (string-match "^\\([^ ]*\\) \\([^ ]*\\) *:\\(.*$\\)" rest)
(let ((match1 (matching-substring rest 1))
(match2 (matching-substring rest 2))
(match3 (matching-substring rest 3)))
(if (string= match2 irchat-real-nickname)
(progn
(irchat-w-insert (irchat-pick-buffer match1)
(format
"%sYou were kicked off channel %s by %s%s.\n"
irchat-change-prefix
match1
prefix
(if (or (not match3)
(string= "" match3)
(string= prefix match3))
""
(concat " (" match3 ")"))))
(setq
irchat-current-channels
(string-list-ci-delete match1 irchat-current-channels)
irchat-current-channel (car irchat-current-channels)
irchat-channel-indicator (if irchat-current-channel
(format "Channel %s"
irchat-current-channel)
"No channel"))
(irchat-set-crypt-indicator)
(irchat-remove-from-thischannel irchat-real-nickname match1))
(irchat-w-insert irchat-D-buffer
(format "%s%s has kicked %s out%s%s\n"
irchat-change-prefix prefix match2
(if (string= (or irchat-current-channel "") match1)
""
(format " from channel %s" match1))
(if (or (not match3)
(string= "" match3)
(string= prefix match3))
""
(concat " (" match3 ")"))))))
(message "IRCHAT: Strange KICK.")))
(defun irchat-handle-invite-msg (parsed-sender parsed-msg prefix rest)
(if (string-match " :\\([^ ]+\\)" rest)
(let ((chnl (matching-substring rest 1)))
(irchat-w-insert irchat-D-buffer
(format "%s%s invites you to channel %s\n"
irchat-info-prefix prefix chnl))
(setq irchat-invited-channel chnl))
(message "IRCHAT: Strange INVITE")))
(defun irchat-handle-kill-msg (parsed-sender parsed-msg prefix rest)
(if (string-match "[^ ]+ +:\\(.*\\)" rest)
(let ((path (matching-substring rest 1)))
(irchat-w-insert irchat-D-buffer
(format
"%sIRCHAT: You were killed by %s. Path: %s. RIP\n"
irchat-info-prefix prefix path)))
(message "IRCHAT: strange KILL"))
(setq irchat-channel-indicator "No channel")
(irchat-set-crypt-indicator))
(defun irchat-handle-join-msg (parsed-sender parsed-msg prefix rest) ; kmk 14101990, tri 03071997
(let* ((parse (irchat-parse-^G-channel-name rest))
(flags (cdr parse))
(rest (car parse)))
(if (string= prefix irchat-real-nickname)
(progn
(setq irchat-current-channel rest)
(setq irchat-current-channels
(cons irchat-current-channel irchat-current-channels))
(setq irchat-channel-indicator
(format "Channel %s" rest))
(irchat-set-crypt-indicator))
(irchat-add-to-channel prefix rest))
(if (and (not irchat-ignore-changes)
(or (not irchat-ignore-changes-from-ignored)
(not (irchat-ignore-this-p prefix irchat-userathost))))
(if irchat-compress-changes
(let* ((text (format " \\(has\\|have\\) joined channel %s"
(regexp-quote rest)))
(match (format "^%s.* .*%s$"
(regexp-quote irchat-change-prefix) text))
(default (format "%s%s%s (%s) has joined channel %s\n"
irchat-change-prefix
prefix
(if flags (format " [%s]" flags) "")
irchat-userathost
rest)))
(irchat-w-replace (irchat-pick-buffer rest) match default text
(format ", %s%s (%s) have joined channel %s"
prefix
(if flags (format " [%s]" flags) "")
irchat-userathost
rest)))
(irchat-w-insert (irchat-pick-buffer rest)
(format "%s%s%s (%s) has joined channel %s\n"
irchat-change-prefix
prefix
(if flags (format " [%s]" flags) "")
irchat-userathost
rest))))
(irchat-nick-to-uah-append prefix irchat-userathost irchat-userathost-type)
(irchat-change-nick-of prefix prefix)))
(defun irchat-handle-part-msg (parsed-sender parsed-msg prefix rest) ; kmk, 14101990
(if (string-match "\\([^ ]*\\)\ .*" rest)
(setq rest (matching-substring rest 1))) ;; throw away user given info.
(if (string= prefix irchat-real-nickname)
(progn
(setq irchat-current-channels
(string-list-ci-delete rest irchat-current-channels)
irchat-current-channel (car irchat-current-channels)
irchat-channel-indicator (if irchat-current-channel (format "Channel %s" irchat-current-channel) "No channel"))
(irchat-set-crypt-indicator)))
(if (and (not irchat-ignore-changes)
(or (not irchat-ignore-changes-from-ignored)
(not (irchat-ignore-this-p prefix irchat-userathost))))
(if irchat-compress-changes
(let* ((text (format " \\(has\\|have\\) left channel %s"
(regexp-quote rest)))
(match (format "^%s.*%s$" (regexp-quote irchat-change-prefix) text))
(default (format "%s%s has left channel %s\n"
irchat-change-prefix prefix rest)))
(irchat-w-replace (irchat-pick-buffer rest)
match default text (format ", %s have left channel %s" prefix rest)))
(irchat-w-insert (irchat-pick-buffer rest)
(format "%s%s has left channel %s\n" irchat-change-prefix prefix rest))))
(irchat-remove-from-thischannel prefix rest)
(irchat-change-nick-of prefix prefix))
(defun irchat-pick-buffer (chnl)
(let ((mylist irchat-buffer-preferences)
(found nil)
(result nil))
(while (and chnl (not found) mylist)
(if (string-match (car (car mylist)) chnl)
(setq result (car (cdr (car mylist)))
found t))
(setq mylist (cdr mylist)))
(if result
result
irchat-D-buffer)))
(eval-and-compile
(provide 'irchat-handle))
;;;
;;; eof
;;;