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
|
# Default aliases file
#
# TODO:
# ignore, notify and unignore should go in the core
#
# If possible, get rid of $str.* from the default popups
# avoiding to load the module at every channel popup open action...
# (Find a core function that retrieves the number of nicknames passed ?)
# Another solution would be to increase the str.module core lock-time ?
#
#
# Backward compatibility stuff
#
alias(avatar)
{
# avatar target file
if(!$0)
{
echo "Missing target, no action taken"
return
}
if($1)
{
avatar.set $1
}
avatar.notify $0
}
alias(clear)
{
window.clearOutput
}
alias(connect)
{
objects.connect $0 $1 $2 $3
}
alias(disconnect)
{
objects.disconnect $0 $1 $2 $3
}
alias(killclass)
{
objects.killclass $0
}
alias(clearobjects)
{
objects.clear $0
}
alias(nickserv)
{
# Silent
raw -q NickServ $0-
}
alias(chanserv)
{
# Silent
raw -q ChanServ $0-
}
alias(memoserv)
{
# Silent
raw -q MemoServ $0-
}
alias(ns)
{
# Silent
raw -q nickserv $0-
}
alias(cs)
{
# Silent
raw -q chanserv $0-
}
alias(ms)
{
# Silent
raw -q memoserv $0-
}
alias(gnotice)
{
# Global notice
#Check null notice
if(!$0){
echo $tr("Usage"): /gnotice [-waohvq] <$tr("message")>
echo $tr("-m: send a message instead of a notice")
echo $tr("-w: send notice to all channel owners")
echo $tr("-a: send notice to all channel admins")
echo $tr("-o: send notice to all channel ops")
echo $tr("-h: send notice to all channel halfops")
echo $tr("-v: send notice to all channel voices")
echo $tr("-q: quiet mode")
halt
}
# Detect message type
if($sw(m)) %cmd="msg"
else %cmd="notice"
# Check for quiet message
if($sw(q)) %cmd=$str.append(%cmd," -q")
# Check null switches
if((!$sw(w))&&(!$sw(a))&&(!$sw(o))&&(!$sw(h))&&(!$sw(v))){
eval %cmd $chan.name($active) $0-
halt
}
# Check switches passed
if($sw(w)) eval %cmd \~$chan.name($active) $0-
if($sw(a)) eval %cmd \!$chan.name($active) $0-
if($sw(o)) eval %cmd \@$chan.name($active) $0-
if($sw(h)) eval %cmd \%$chan.name($active) $0-
if($sw(v)) eval %cmd \+$chan.name($active) $0-
}
alias(wallop)
{
if(!$0){
echo $tr("Usage"): /wallop <$tr("message")>
halt
}
# Due to server flood, timing may be very high
echo -w=$active $tr("Sending wallop to") $chan.name($active)
timer(wallop,5000,$chan.users(,,o),$0-){
if(%:localOps == ""){ %:localOps = $chan.users(,,o); %:curIndex = 0; }
if(%:curIndex == %:localOps[]#){ killtimer wallop; return; }
for(%i=0;%i<1;%i++){
if(%:localOps[%:curIndex] != $my.nick){
if(%:curIndex == %:localOps[]#){ killtimer wallop; return; }
msg -q %:localOps[%:curIndex] $1-
%:curIndex++
}
}
}
}
alias(kill){
raw -q kill $0 :$1-
}
alias(ms)
{
# Silent
quote ms $0-
}
# j: This is a really common one
alias(j)
{
#first we do a test if a chan is given as parameter
if(!$0)
{
echo $tr("Usage:")
echo " /j <chan>"
} else {
join $0-
}
}
# s: This too
alias(s)
{
if(!$0)
{
echo $tr("Usage:")
echo " /s <server>"
} else {
server $0-
}
}
# q: Ok, I am lazy :P
alias(q)
{
if(!$0)
{
echo $tr("Usage:")
echo " /q <nick>"
} else {
query $0-
}
}
# names: maybe this should be implemented on the core?
alias(names)
{
if(!$0)
{
if($window.type($active)!="channel")
{
echo $tr("Usage:") "/names <channel>"
} else {
raw names $active
}
} else {
raw names $0-
}
}
# kickban
alias(kb)
{
if(!$0)
{
echo $tr("Usage:")
echo " /kb <nick_list> [" $tr("reason") "]"
halt;
}
if(!$channel)
{
echo "[KB]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
%mask = $mask(%nick,$option(uintDefaultBanType));
if(!%mask)%mask = %nick; # plain ban
%reason = $1-
#if(!%reason)%reason = "You're not welcome here!"
# This is tricky : we send everything
# as a single raw message just because
# we do not want delays between kick and ban
# if anti-server-flood is enabled
%raw = "kick $target %nick :%reason"
# kick %nick %reason
if($chan.isOp(%nick))%raw2 = "mode $target -o+b %nick %mask"
else %raw2 = "mode $target +b %mask"
raw -q %raw2$cr$lf%raw
}
}
}
# chanowner
alias(chanowner)
{
if(!$0)
{
echo $tr("Usage:")
echo " /chanowner <nick_list>"
halt;
}
if(!$channel)
{
echo "[CHANOWNER]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() +q %nick
}
}
}
# chanadmin
alias(chanadmin)
{
if(!$0)
{
echo $tr("Usage:")
echo " /chanadmin <nick_list>"
halt;
}
if(!$channel)
{
echo "[CHANADMIN]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() +a %nick
}
}
}
# dechanowner
alias(dechanowner)
{
if(!$0)
{
echo $tr("Usage:")
echo " /dechanowner <nick_list>"
halt;
}
if(!$channel)
{
echo "[DECHANOWNER]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() -q %nick
}
}
}
# dechanadmin
alias(dechanadmin)
{
if(!$0)
{
echo $tr("Usage:")
echo " /dechanadmin <nick_list>"
halt;
}
if(!$channel)
{
echo "[DECHANADMIN]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() -a %nick
}
}
}
# halfop
alias(halfop)
{
if(!$0)
{
echo $tr("Usage:")
echo " /halfop <nick_list>"
halt;
}
if(!$channel)
{
echo "[HALFOP]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() +h %nick
}
}
}
# dehalfop
alias(dehalfop)
{
if(!$0)
{
echo $tr("Usage:")
echo " /dehalfop <nick_list>"
halt;
}
if(!$channel)
{
echo "[DEHALFOP]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() -h %nick
}
}
}
# userop
alias(userop)
{
if(!$0)
{
echo $tr("Usage:")
echo " /userop <nick_list>"
halt;
}
if(!$channel)
{
echo "[USEROP]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() +u %nick
}
}
}
# deuserop
alias(deuserop)
{
if(!$0)
{
echo $tr("Usage:")
echo " /deuserop <nick_list>"
halt;
}
if(!$channel)
{
echo "[DEUSEROP]: " $tr("This is not a channel window")
halt;
}
foreach(%nick,$str.split(",",$0))
{
if(%nick)
{
mode $chan.name() -u %nick
}
}
}
# ame and amsg
alias(ame)
{
foreach(%i,$window.list(channel))if(%i!="") me -r=%i $0-
}
alias(amsg)
{
foreach(%i,$window.list(channel))msg $target(%i) $0-
}
alias(amsgall)
{
foreach(%i,$window.list(channel),$window.list(query))msg $target(%i) $0-
}
alias(ameall)
{
foreach(%i,$window.list(channel),$window.list(query)){
if(%i!="") me -r=%i $0-
}
}
alias(awayall)
{
foreach(%w,$window.list(console,all))away -r=%w $0-;
}
# notify: this is a bit more complex
# We want to add an user to the notify list with a single command
# The notify lists are handled thru the registered users database
alias(notify)
{
# This one adds a registered users database entry
# For the specified nick and uses the specified mask
# If no mask is specified , a default one is constructed
# Then the "notify" property is set for the user
if(!$0)
{
echo $tr("Usage:")
echo " /notify <nick> [mask]"
halt
}
# Get the mask
%mask = $1
# no mask specified ? build it
if(!%mask)%mask = $0!*@*
# Now add the user (but do not replace old entries)
reguser.add -f -q $0 %mask
# Merge the notify property part with the old one (if any)
%oldNicks = $reguser.property($0,notify)
# It would be a good idea to check if the nikckname is already in the %oldNicks list
# but this is left as exercise for the reader.
%oldNicks << $0
# And finally set the property (use -n so the notify lists will be restarted)
reguser.setproperty -n $0 notify $0
# done...the notify list should be restarted now
}
alias(ignore)
{
# This one adds a registered users database entry
# For the specified nick and uses the specified mask
# If no mask is specified , a default one is constructed
# Then the "ignore" property is set for the user to 1
if(!$0)
{
echo $tr("Usage:")
echo " /ignore [-r] <nick>"
halt
}
# Now add the user (but do not replace old entries)
reguser.add $0 $mask($0,15);
# And finally set the property (use -n so the notify lists will be restarted)
# Check if ignore or unignore the user
if(!$sw(r,remove))
{
reguser.setIgnoreEnabled $0 1
reguser.setIgnoreFlags -p -c -n -t -i -d $0
} else reguser.setIgnoreEnabled $0 0
}
# Dcc...people commonly use "dcc send" instead of "dcc.send"
alias(dcc)
{
switch($0)
{
case(send):
{
dcc.send $1-
break
}
case(chat):
{
dcc.chat $1-
break
}
case(voice):
{
dcc.voice $1-
break
}
case(allow):
{
quote dccallow $1-
break
}
default:
{
echo "[DCC]: " $tr("Unsupported type: $0")
}
}
}
#
# return a string with the name of the curerent usermode
#
alias(usermodename)
{
if(!$0)
{
echo $tr("Usage:")
echo " /usermodename <nick>"
halt;
}
if(!$channel)
{
echo "[USERMODENAME]: " $tr("This is not a channel window")
halt;
}
if($chan.isOwner($0,$channel)){
return $tr("Channel Owner")
} elseif($chan.isAdmin($0,$channel)){
return $tr("Channel Administrator")
} elseif($chan.isOp($0,$channel)){
return $tr("Channel Operator")
} elseif($chan.isHalfOp($0,$channel)){
return $tr("Half Operator")
} elseif($chan.isVoice($0,$channel)){
return $tr("Voice")
} elseif($chan.isUserOp($0,$channel)){
return $tr("User Operator")
} else {
return $tr("Normal User")
}
}
alias(dccallow)
{
quote dccallow \+$0
}
#shortcut for commonly called algorithm
alias(md5)
{
return $str.digest($0-,md5)
}
alias(sha1)
{
return $str.digest($0-,sha1)
}
# DNS : people like it
alias(dns)
{
if(!$context)
{
echo "[DNS]: " $tr("You must use DNS in an IRC context")
halt
}
if(!$server)
{
echo "[DNS]: " $tr("You must be connected to a server")
halt
}
if(!$0)
{
echo $tr("Usage:")
echo echo " /dns <nickname>"
halt
}
if($isWellKnown($0))host -a $hostname($0)
else {
awhois($0)
{
if(!$2)
{
echo "[DNS]: " $tr("No such user: $0")
} else {
host -a $2
}
}
}
}
alias(ss)
{
# Silent
quote ss $0-
}
alias(seenserv)
{
# Silent
msg -q SeenServ $0-
}
alias(hs)
{
#Silent
quote hs $0-
}
alias(hop)
{
// Retrieve channel
%chan=$0
if(!%chan) %chan=$chan.name($active)
// Retrieve channel key
%key=$chan.key($channel(%chan))
// Exit channel
if($window.type($channel(%chan))=="channel")
part --keep %chan $option(stringPartMessage)
// Rejoin channel
if(!%key) join %chan
else join %chan %key
}
|