-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirchat-300.el
605 lines (519 loc) · 21.4 KB
/
irchat-300.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
;;; -*- emacs-lisp -*-
;;;
;;; see file irchat-copyright.el for change log and copyright info
(eval-when-compile
(require 'irchat-inlines))
(eval-and-compile
(require 'irchat-filter)
(require 'irchat-vars))
;;;
;;; 300 replies
;;;
(defvar irchat-recursing-whois nil)
(defvar irchat-recursing-whowas nil)
(defvar irchat-recursing-whois-for-host-mask nil)
(defun irchat-handle-300-msgs (number parsed-sender parsed-msg prefix rest)
"Generic handler for 3?? messages.
This is called if no specific handler exists"
(if (string-match "[^ ]* \\([^ :]*\\) *\\([^ :]*\\) *:\\(.*\\)" rest)
(let ((target1 (matching-substring rest 1))
(target2 (matching-substring rest 2))
(msg (matching-substring rest 3)))
(cond ((string-equal target1 "")
(irchat-w-insert irchat-300-buffer
(format "%s%s\n" irchat-info-prefix msg)))
((string-equal target2 "")
(irchat-w-insert irchat-300-buffer
(format "%s%s (%s)\n"
irchat-info-prefix msg target1)))
(t
(irchat-w-insert irchat-300-buffer
(format "%s%s %s (%s)\n"
irchat-info-prefix target1 msg target2))))
)
(message "IRCHAT: Strange %s reply" number)))
(defun irchat-handle-301-msg (parsed-sender parsed-msg prefix rest)
"Handle the 301 RPL_AWAY."
(if (string-match "^[^ ]+ \\([^ ]+\\) +:\\(.*\\)" rest)
(let ((who (matching-substring rest 1))
(iswhat (matching-substring rest 2)))
(if (not irchat-recursing-whois)
(irchat-w-insert irchat-300-buffer
(format
"%s%s is marked as being AWAY, but left the message:\n%s\n"
irchat-info-prefix who iswhat))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 301 reply")))
(defun irchat-handle-302-msg (parsed-sender parsed-msg prefix rest)
"Handle the 302 USERHOST."
(while (string-match
"^[^ ]* :[ ]*\\([^*=]+\\)\\([*]*\\)=\\([+-]\\)\\([^ ]+\\)" rest)
(let ((nick (matching-substring rest 1))
(oper (matching-substring rest 2))
(away (matching-substring rest 3))
(who (matching-substring rest 4)))
(irchat-w-insert irchat-300-buffer
(format "%sNick %s is %s [%s, %s]\n"
irchat-info-prefix
nick who
(concat (if (string= oper "") "Not ")
"Operator")
(concat (if (string= away "+") "Not ")
"AWAY")))
(setq rest (concat " :" (substring rest (match-end 4) nil))))))
(defun irchat-handle-303-msg (parsed-sender parsed-msg prefix rest)
"Handle the 303 ISON"
(if (string-match "[^ ]+ :\\(.*\\)" rest)
(if (string= (matching-substring rest 1) "")
(irchat-w-insert irchat-300-buffer
(format "%sNo one you requested is on now.\n"
irchat-info-prefix))
(irchat-w-insert irchat-300-buffer
(format "%sFollowing people(s) are on: %s\n"
irchat-info-prefix
(matching-substring rest 1))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 303 reply")))
(defun irchat-handle-305-msg (parsed-sender parsed-msg prefix rest)
"Handle the 305 UNAWAY"
(if (string-equal irchat-away-indicator "A")
(progn
(setq irchat-away-indicator "-")
(irchat-maybe-poll)
(if (string-match "[^:]:\\(.*\\)" rest)
(let ((msg (matching-substring rest 1)))
(irchat-w-insert irchat-300-buffer
(format "%s%s (%s)\n"
irchat-info-prefix msg
(if irchat-format-time-function
(apply irchat-format-time-function
(list (current-time-string)))
(current-time-string)))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 305 reply\n")))))
(defun irchat-handle-306-msg (parsed-sender parsed-msg prefix rest)
"Handle the 306 NOWAWAY"
(setq irchat-away-indicator "A")
(if (string-match "[^:]:\\(.*\\)" rest)
(let ((msg (matching-substring rest 1)))
(irchat-w-insert irchat-300-buffer
(format "%s%s (%s)\n"
irchat-info-prefix msg
(if irchat-format-time-function
(apply irchat-format-time-function
(list (current-time-string)))
(current-time-string)))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 306 reply\n")))
(defun irchat-handle-311-msg (parsed-sender parsed-msg prefix rest)
"Handle the 311 WHOISUSER."
(if (string-match "[^ ]+ \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) :\\(.*\\)" rest)
(let ((nick (matching-substring rest 1))
(username (matching-substring rest 2))
(machine (matching-substring rest 3))
(channel (matching-substring rest 4))
(realname (matching-substring rest 5)))
(if (not irchat-recursing-whois)
(irchat-w-insert irchat-300-buffer
(format "%s%s is %s (%s) at %s\n"
irchat-info-prefix
nick username realname machine))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 311 reply")))
(defun irchat-handle-312-msg (parsed-sender parsed-msg prefix rest)
"Handle the 312 WHOISSERVER."
(if (string-match "^[^ ]+ \\(\\([^ ]+\\) \\)?\\([^ ]+\\) :\\(.*\\)" rest)
(let ((who (matching-substring rest 2))
(server (matching-substring rest 3))
(real (matching-substring rest 4)))
(if (and (not (irchat-dcc-compare-hostnames server irchat-server))
(not irchat-recursing-whois-for-host-mask)
(not irchat-recursing-whois)
(not irchat-recursing-whowas))
(progn
(if (string-match "\*\..*" server)
(setq irchat-recursing-whois-for-host-mask t))
(setq irchat-recursing-whois t)
(irchat-send "WHOIS %s %s" server who))
(if irchat-recursing-whois-for-host-mask
(progn
(setq irchat-recursing-whois-for-host-mask nil)
(irchat-send "WHOIS %s %s" server who))
(progn
(setq irchat-recursing-whois nil)
(setq irchat-recursing-whois-for-host-mask nil)
(irchat-w-insert irchat-300-buffer
(format "%son via server %s (%s)\n"
irchat-info-prefix server real))))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 312 reply")))
(defun irchat-handle-313-msg (parsed-sender parsed-msg prefix rest)
"Handle the 313 WHOISOPERATOR."
(if (string-match "^[^ ]+ \\([^ ]+\\) :\\(.*\\)" rest)
(let ((who (matching-substring rest 1))
(iswhat (matching-substring rest 2)))
(if (not irchat-recursing-whois)
(irchat-w-insert irchat-300-buffer
(format "%sSTATUS: %s\n"
irchat-info-prefix iswhat))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 313 reply")))
(defun irchat-handle-316-msg (parsed-sender parsed-msg prefix rest)
"Handle the 316 WHOISCHANOP."
(if (string-match "^\\([^ ]+\\) :\\(.*\\)" rest)
(let ((who (matching-substring rest 1))
(iswhat (matching-substring rest 2)))
(if (not irchat-recursing-whois)
(irchat-w-insert irchat-300-buffer
(format "STATUS: %s\n" iswhat))))
(if (string-match "^\\([^ ]+\\) \\([^ ]+\\) :\\(.*\\)" rest)
(let ((who (matching-substring rest 2))
(iswhat (matching-substring rest 3)))
(if (not irchat-recursing-whois)
(irchat-w-insert irchat-300-buffer
(format "%sSTATUS: %s\n"
irchat-info-prefix iswhat))))
(irchat-w-insert irchat-300-buffer "IRCHAT: Strange 316 reply"))))
(defun irchat-handle-319-msg (parsed-sender parsed-msg prefix rest)
"Handle the 319 reply (what channels user is on)."
(if (string-match "^\\([^ ]+\\) \\([^ ]+\\) :\\(.*\\)" rest)
(let ((who (matching-substring rest 2))
(isonchannels (matching-substring rest 3)))
(if (not irchat-recursing-whois)
(irchat-w-insert irchat-300-buffer
(format "%schannels: %s\n"
irchat-info-prefix isonchannels))))))
(defun irchat-handle-314-msg (parsed-sender parsed-msg prefix rest)
"Handle the 314 WHOWASUSER."
(if (string-match "[^ ]+ \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) :\\(.*\\)" rest)
(let ((nick (matching-substring rest 1))
(username (matching-substring rest 2))
(machine (matching-substring rest 3))
(channel (matching-substring rest 4))
(realname (matching-substring rest 5)))
(message "")
(setq irchat-recursing-whowas t)
(irchat-w-insert irchat-300-buffer (format "%s%s [%s] was %s (%s) at %s\n"
irchat-info-prefix
nick
(if (string= channel "*") "Priv" channel)
username
realname
machine)))
(message "IRCHAT: Strange 314 reply"))
)
(defun irchat-handle-315-msg (parsed-sender parsed-msg prefix rest)
"Handle the 315 ENDOFWHO."
nil)
(defun irchat-317-args-parse (str)
(let* ((al (irchat-split-protocol-args str))
(nl (if (> (length al) 1)
(split-string (nth (- (length al) 1) al)
",[ \t]*")
'()))
(r '()))
(if (eq (length nl) (- (length al) 1))
(while nl
(setq r (cons (cons (car nl) (car al)) r))
(setq nl (cdr nl))
(setq al (cdr al))))
r))
(defun irchat-317-args-lookup (name parsed-args)
(let ((r nil))
(while parsed-args
(if (string-ci-equal name (car (car parsed-args)))
(setq r (cdr (car parsed-args))
parsed-args '())
(setq parsed-args (cdr parsed-args))))
r))
(defun irchat-handle-317-msg (parsed-sender parsed-msg prefix rest)
"Handle the 317 WHOISIDLE."
(let ((s nil)
(l nil))
(if (string-match "^[^ ]+ [^ ]+ \\(.*\\)" rest)
(let ((p (irchat-317-args-parse (matching-substring rest 1))))
(setq s (irchat-317-args-lookup "seconds idle" p)
l (irchat-317-args-lookup "signon time" p))))
(if (and (null s)
(string-match "^[^ ]+ \\([0-9]*\\) :\\(.*\\)" rest))
(setq s (matching-substring rest 1)))
(if (and (null s)
(string-match
"^\\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) +\\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) :\\(.*\\)"
rest))
(let ((dofw (matching-substring rest 2))
(month (matching-substring rest 3))
(date (matching-substring rest 4))
(time (matching-substring rest 5))
(year (matching-substring rest 6)))
(irchat-w-insert irchat-300-buffer
(format "%sLast input received %s.\n"
irchat-info-prefix
time))
(setq s 0)))
(if (not (null l))
(let ((c (irchat-time-val-string-to-current-time-format l)))
(if (not (null c))
(irchat-w-insert irchat-300-buffer
(format "%sSign-on time is %s\n"
irchat-info-prefix
(if irchat-format-time-function
(apply irchat-format-time-function
(list (current-time-string
c)))
(current-time-string c)))))))
(if (not (null s))
(if (stringp s)
(irchat-w-insert irchat-300-buffer
(format "%sIDLE for %s\n"
irchat-info-prefix
(irchat-convert-seconds s))))
(message "IRCHAT: Strange 317 reply"))))
(defun irchat-handle-318-msg (parsed-sender parsed-msg prefix rest)
"Handle the 318 ENDOFWHOIS."
nil)
(defun irchat-handle-321-msg (parsed-sender parsed-msg prefix rest)
"Handle the 321 LISTSTART. (first of names)"
(irchat-w-insert irchat-300-buffer
(format "%s%-10s%6s %s\n"
irchat-info-prefix "Channel" "Users" "Topic")))
(defun irchat-handle-322-msg (parsed-sender parsed-msg prefix rest)
"Handle the 322 LIST.(from NAMES)."
(if (string-match "^\\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) :\\(.*\\)" rest)
(let ((chnl (matching-substring rest 2))
(users (matching-substring rest 3))
(topic (matching-substring rest 4)))
(if (or (string= irchat-channel-filter (downcase chnl))
(string= irchat-channel-filter "")
(and (string= irchat-channel-filter "0")
(string= chnl "*")))
(progn
(put (intern chnl irchat-obarray) 'topic topic)
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%-10s%6s user%s%s%s\n"
irchat-info-prefix
(if (string= chnl "*") "Priv"
chnl)
users
(if (> (string-to-int users) 1) "s" " ")
(if (string= "" topic) "" ": ")
topic)))))
(message "IRCHAT: Strange 322 reply")))
(defun irchat-handle-323-msg (parsed-sender parsed-msg prefix rest)
"Handle the 323 RPL_LISTEND. (end of names)"
nil)
(defun irchat-handle-324-msg (parsed-sender parsed-msg prefix rest)
"Handle the 324 CHANNELMODEIS."
(if (string-match "[^ ]* \\([^ ]*\\) \\(.*\\)" rest)
(let ((chnl (matching-substring rest 1))
(str (matching-substring rest 2)))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%sMode for %s is %s\n"
irchat-info-prefix chnl str)))
(message (format "IRCHAT: Strange 324 reply '%s'" rest))))
(defun irchat-handle-331-msg (parsed-sender parsed-msg prefix rest)
"Handle the 331 NOTOPIC"
(if (string-match "[^ ]* \\([^ ]*\\) \\(.*\\)" rest)
(let ((ichan (intern (matching-substring rest 1) irchat-obarray)))
(put ichan 'topic nil)
(irchat-w-insert irchat-300-buffer
(format "%sIRCHAT: No topic is set\n"
irchat-info-prefix)))))
(defun irchat-handle-332-msg (parsed-sender parsed-msg prefix rest)
"Handle the 332 TOPIC."
(if (string-match "[^ ]* \\([^ ]*\\) +:\\(.*\\)" rest)
(let ((ichan (intern (matching-substring rest 1) irchat-obarray))
(topic (matching-substring rest 2)))
(put ichan 'topic topic)
(irchat-w-insert irchat-300-buffer
(format "%sTopic: %s\n" irchat-info-prefix topic)))
(message "IRCHAT: Strange 332 message")))
(defun irchat-handle-341-msg (parsed-sender parsed-msg prefix rest)
"Handle the 341 INVITING."
(if (string-match "^\\([^ ]+\\) +\\([^ ]+\\) +\\([-#&0-9+][^ ]*\\)" rest)
(let ((who (matching-substring rest 1))
(nick (matching-substring rest 2))
(chnl (matching-substring rest 3)))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%sInviting user %s to channel %s\n"
irchat-info-prefix nick chnl)))
(message "Strange 341 message")))
(defun irchat-handle-351-msg (parsed-sender parsed-msg prefix rest)
"Handle the 351 VERSION."
(if (string-match "[^ ]+ \\([^ ]+\\) :*\\([^ ]+\\)[ :]*\\(.*\\)" rest)
(let ((version (matching-substring rest 1))
(machine (matching-substring rest 2))
(comments (matching-substring rest 3)))
(irchat-w-insert irchat-300-buffer
(format "%sMachine %s is running IRC version %s (%s)\n"
irchat-info-prefix machine version comments)))
(message "IRCHAT: Strange 351 reply")))
(defun irchat-handle-whoreply-msg (parsed-sender parsed-msg prefix rest)
(irchat-handle-352-msg parsed-sender parsed-msg prefix rest))
(defun irchat-handle-352-msg (parsed-sender parsed-msg prefix rest)
"Handle the 352 WHOREPLY."
(if (string-match "\\([^ ]*\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) :[0-9]* ?\\(.*\\)" rest)
(let* ((chnl (matching-substring rest 1))
(user (matching-substring rest 2))
(host (matching-substring rest 3))
(nick (matching-substring rest 5))
(oper (matching-substring rest 6))
(name (matching-substring rest 7))
(chan-buffer (irchat-pick-buffer chnl)))
(irchat-w-insert chan-buffer
(format "%s%3s %10s %9s %-29s%s\n"
irchat-info-prefix
oper ;; Kaizzu 06/03/90
(if (string= chnl "*") "Priv" ; *WORK* needed
(if (string= chnl "0")
"Priv"
chnl))
nick
(format "<%s@%s>" user
(irchat-clean-hostname host))
name)))
(message "IRCHAT: Strange 352 message")))
(defun irchat-handle-namreply-msg (parsed-sender parsed-msg prefix rest)
(irchat-handle-353-msg parsed-sender parsed-msg prefix rest))
(defun irchat-count-words-from-string (str)
"count words from a string"
(let* ((len (- (length str) 1)) ; string is from [0,len[
(i len) (seen nil) (words (if (< len 0) 0 1)))
(while (not (< i 0))
(progn
(if (string= (char-to-string (aref str i)) " ")
(if seen
(setq words (+ words 1)))
(setq seen t))
(setq i (- i 1))))
words))
(defun irchat-handle-346-msg (parsed-sender parsed-msg prefix rest)
"Handle the 346 invitation list."
(if (string-match "[^ ]* \\([^ ]*\\) \\([^ ]*\\)" rest)
(let ((chnl (matching-substring rest 1))
(regexp (matching-substring rest 2)))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%s carries invitation to %s\n"
irchat-info-prefix regexp chnl)))
(message "IRCHAT: Strange 346 message")))
(defun irchat-handle-347-msg (parsed-sender parsed-msg prefix rest)
"Handle the 347 ???????."
nil)
(defun irchat-handle-348-msg (parsed-sender parsed-msg prefix rest)
"Handle the 348 ban exceptions."
(if (string-match "[^ ]* \\([^ ]*\\) \\([^ ]*\\)" rest)
(let ((chnl (matching-substring rest 1))
(regexp (matching-substring rest 2)))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%s carries exception to ban on %s\n"
irchat-info-prefix regexp chnl)))
(message "IRCHAT: Strange 348 message")))
(defun irchat-handle-349-msg (parsed-sender parsed-msg prefix rest)
"Handle the 347 ???????."
nil)
(defvar irchat-353-nameschnl nil "")
(defvar irchat-353-nameslist "" "names list reply string")
(defvar irchat-353-namescount 0 "")
(defun irchat-handle-353-msg (parsed-sender parsed-msg prefix rest)
"Handle the 353 (NAMREPLY) message. If we are just polling the server,
don't display anything."
(if (string-match "[^ =*@]?[=*@] \\([^ ]*\\) :\\(.*\\)" rest)
(let* ((chnl (matching-substring rest 1))
(users (matching-substring rest 2))
(numusers (irchat-count-words-from-string users)))
(if (> irchat-polling 0)
nil
(progn
(setq irchat-353-nameslist (concat irchat-353-nameslist users)
irchat-353-nameschnl chnl
irchat-353-namescount (+ irchat-353-namescount numusers))))
(irchat-scan-channels chnl)
(irchat-update-thischannel chnl users))
(message "IRCHAT: Strange 353 message")))
(defun irchat-handle-361-msg (parsed-sender parsed-msg prefix rest)
"Handle the 361 KILLDONE."
(if (string-match "[^ ]+ \\([^ ]+\\) +:\\(.*\\)" rest)
(let ((who (matching-substring rest 1))
(message (matching-substring rest 2)))
(irchat-w-insert irchat-300-buffer
(format "%sYou just KILLED %s. %s\n"
irchat-info-prefix who message)))
(message "IRCHAT: Strange 361 reply")))
(defun irchat-handle-364-msg (parsed-sender parsed-msg prefix rest)
(if (string-match "^\\([^ ]+\\) +\\([^ ]*\\) +[^ ]* +:\\(.*\\)" rest)
(progn
(irchat-w-insert irchat-300-buffer
(format "%s%-30s%s\n"
irchat-info-prefix
(matching-substring rest 2)
(matching-substring rest 3))))
(message "IRCHAT: Strange 364 message")))
(defun irchat-handle-365-msg (parsed-sender parsed-msg prefix rest)
"Handle the 365 ENDOFLINKS."
nil)
(defun irchat-handle-366-msg (parsed-sender parsed-msg prefix rest)
"Handle the 366 ENDOFNAMES."
(let ((level (- irchat-polling 1)))
(setq irchat-polling (if (< level 0) 0 level))
(irchat-w-insert (irchat-pick-buffer irchat-353-nameschnl)
(format "%s%-10s%6d user%s: %s\n"
irchat-info-prefix
(if (string= irchat-353-nameschnl "*")
"Priv"
irchat-353-nameschnl)
irchat-353-namescount
(cond
((= irchat-353-namescount 0) "s")
((= irchat-353-namescount 1) "")
(t "s"))
irchat-353-nameslist))
(setq irchat-353-nameslist nil
irchat-353-nameschnl nil
irchat-353-namescount 0)))
(defun irchat-handle-367-msg (parsed-sender parsed-msg prefix rest)
"Handle the 367 BAN."
(if (string-match "[^ ]* \\([^ ]*\\) \\([^ ]*\\)" rest)
(let ((chnl (matching-substring rest 1))
(regexp (matching-substring rest 2)))
(irchat-w-insert (irchat-pick-buffer chnl)
(format "%s%s has been banned on %s\n"
irchat-info-prefix regexp chnl)))
(message "IRCHAT: Strange 367 message")))
(defun irchat-handle-368-msg (parsed-sender parsed-msg prefix rest)
"Handle the 368 ???????."
nil)
(defun irchat-handle-369-msg (parsed-sender parsed-msg prefix rest)
"Handle the 369 WHOWAS."
(setq irchat-recursing-whowas nil)
nil)
(defun irchat-handle-371-msg (parsed-sender parsed-msg prefix rest)
"Handle the 371 INFO."
(if (string-match "^\\([^ ]+\\) +:?\\(.*\\)" rest)
(let ((msg (matching-substring rest 2)))
(irchat-w-insert irchat-300-buffer
(format "%s%s\n" irchat-info-prefix msg)))
(message "IRCHAT: Strange 371 message")))
(defun irchat-handle-372-msg (parsed-sender parsed-msg prefix rest)
"Handle the 372 MOTD."
(string-match "^\\([^ ]+\\) +:?\\(.*\\)" rest)
(let ((msg (matching-substring rest 2)))
(irchat-w-insert irchat-300-buffer (format "%s%s\n" irchat-info-prefix msg))
))
(defun irchat-handle-381-msg (parsed-sender parsed-msg prefix rest)
"Handle the 381 YOUREOPER. ."
(if (string-match "^\\([^ ]+\\) +:\\(.*\\)" rest)
(let ((message (matching-substring rest 2)))
(irchat-w-insert irchat-300-buffer
(format "%sOPER: %s\n" irchat-info-prefix message)))
(message "IRCHAT: Strange 381 reply")))
(defun irchat-handle-382-msg (parsed-sender parsed-msg prefix rest)
"Handle the 382 REHASHING."
(string-match "^\\([^ ]+\\) +:\\(.*\\)" rest)
(let ((name (matching-substring rest 1))
(msg (matching-substring rest 2)))
(irchat-w-insert irchat-300-buffer
(format "%s%s: %s\n" irchat-info-prefix name msg))))
(defun irchat-handle-391-msg (parsed-sender parsed-msg prefix rest)
"Handle the 391 TIME."
(if (string-match "^\\([^ ]+\\) +\\(.*\\)" rest)
(let ((time (matching-substring rest 2)))
(irchat-w-insert irchat-300-buffer
(format "%sServer time: %s\n" irchat-info-prefix
time)))
(message "IRCHAT: Strange 391 message")))
;;;
;;; eof
;;;