summaryrefslogtreecommitdiffstats
path: root/extra/eggdrop/gseen.mod.patch
blob: e70aef88734890026a3d85b7fa5a59a1373b65a0 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
diff -Nur src/mod/gseen.mod/Makefile src/mod/gseen.mod/Makefile
--- src/mod/gseen.mod/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/Makefile	2002-10-26 13:17:44.000000000 +0200
@@ -0,0 +1,28 @@
+# Makefile for src/mod/gseen.mod/
+
+doofus:
+	@echo ""
+	@echo "Let's try this from the right directory..."
+	@echo ""
+	@cd ../../../; make
+
+clean:
+	@rm -f *.o *.$(MOD_EXT) *~
+
+static: ../gseen.o
+
+modules: ../../../gseen.$(MOD_EXT)
+
+../gseen.o: ../module.h ../modvals.h ../../eggdrop.h datahandling.c \
+ gseen.c sensors.c gseencmds.c gseencmds.c do_seen.c ai.c tclcmds.c \
+ misc.c seentree.c generic_binary_tree.c slang_gseen_commands.c \
+ slang.c slang_text.c slang_ids.c slang_chanlang.c seenlang.h \
+ slang_multitext.c gseen.h
+	$(CC) $(CFLAGS) $(CPPFLAGS) -DMAKING_MODS -c gseen.c
+	rm -f ../gseen.o
+	mv gseen.o ../
+
+../../../gseen.$(MOD_EXT): ../gseen.o
+	$(LD) -o ../../../gseen.$(MOD_EXT) ../gseen.o $(XLIBS)
+
+#safety hash
diff -Nur src/mod/gseen.mod/README src/mod/gseen.mod/README
--- src/mod/gseen.mod/README	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/README	2002-10-26 13:17:45.000000000 +0200
@@ -0,0 +1,140 @@
+Description:
+------------
+
+gseen.mod is a seen module for eggdrop that tracks not only the users in the
+bot's userfile, but everyone who enters one of the bots channels.
+It does pretty much the same as the popular script bseen and has a few
+additional features like AI-seen and seen-notification.
+It's also way faster than any corresponding script because scripts are always
+much slower than modules. Especially scripts that deal with large amount of
+data often become incredible slow.
+
+Installation:
+-------------
+
+gseen.mod is written for eggdrop1.6, but it should also work with eggdrop 1.4.
+
+You need the eggdrop source to compile the module.
+
+The following instructions assume, ~/eggdrop1.6.2/ is the directory
+where you installed your eggdrop from. (of course, other source dirs
+will work as well)
+
+Put gseen.mod.1.1.0.tar.gz in ~/eggdrop1.6.2/src/mod/,
+and unpack it (tar xfz gseen.mod.1.1.0.tar.gz). Change directory
+back to ~/eggdrop1.6.2/.
+
+Now just do what you've done when you compiled your bot:
+"./configure"
+"make config" (you can skip this command on eggdrop 1.4)
+"make"
+"make install"
+
+Don't forget to copy the langfiles from eggdrop1.6.2/src/mod/gseen.mod/ to
+eggdrop/language.
+
+All settings can be found in ~/eggdrop1.6.2/src/mod/gseen.mod/gseen.conf
+Copy it to your eggdrop directory, edit it to fit your needs and put
+"source gseen.conf" at the end of your eggdrop config file. The last thing
+to do is to .rehash your bot.
+
+
+Public commands:
+----------------
+
+!seen <nick>
+  I think this command doesn't need an explanation. ^_^
+!seen <mask>
+  Searches the database for entries that match <mask>
+  for example "!seen *!user@dialin-*.isp.com"
+!seennick <nick>
+  !seen also checks if a user was online later with a
+  different nick. !seennick only seens for <nick>
+!seenstats
+  just a little report on how many nicks are tracked
+
+All commands are also accessible via /msg.
+("/msg <bot> seen <nick>", for example)
+
+
+AI seen:
+--------
+
+This module has a simple built in AI routine.
+A short example:
+
+<G`Quann> Argo: have you seen Fabian recently?
+<|Argo|> G`Quann, fabian (~fabian@dns.gifs.de) was last seen quitting
+from #eggdev 1 week 4 days 9 hours 40 minutes 56 seconds ago
+(20.02. 01:39) stating ".....zzzzZZZzzZZZzZZZZZZZZZZzzz..".
+
+Well, it's not a very intelligent AI, it's rather brute-force. So don't
+forget to use the ai-seen-ignore setting.
+I know that's not coded very elegant, but if you configure it correctly,
+the failure-rate is way lower than with other AI scripts...
+
+DCC commands:
+-------------
+
+.seen
+.seennick
+.seenstats
+  just the same as the public versions
+.purgeseens
+  deletes expired data (this also happens automatically once a day)
+  (m)
+
+Channel Settings:
+-----------------
+
+  +noseendata
+	don't log any seen data in this channel
+  +quietseens
+	send answers directly via notice to the person who asked and
+	don't bother the rest of the channel with the reply
+  +quietaiseens
+	same as +quietseens, but for AI seens
+  +nopubseens
+	ignore every seen-command in this channel
+
+TCL commands:
+-------------
+
+There are no special tcl commands, only the usual bind procs.
+
+The only one that should be mentioned is:
+
+*pubm:seen <nick> <uhost> <hand> <chan> <text>
+  triggers the AI seen
+  returns: 1 if a reply was sent, 0 otherwise
+
+So if you're using another AI script on your bot, you can modify it to
+use this proc and avoid doubled replies this way.
+
+Other:
+------
+
+There is absolutely NO WARRANTY on this module. I do my best to make it
+work properly, but if anything gets screwed up, I'm not responsible. Use
+this module at your own risk.
+
+Feedback:
+---------
+
+Feel free to send feedback and bugreports (I hope there won't be any<g>) to
+gseen.mod@visions-of-fantasy.de
+
+The newest gseen version can always be found at:
+http://www.visions-of-fantasy.de/gseen.mod/
+
+Thanks to:
+----------
+
+- Fabian for teaching me plenty of things
+- everyone who tested the many buggy development versions :)
+- the eggdev team for developing eggdrop
+
+Most of all, I would like to thank Bass for writing bseen.tcl because alot
+of the ideas for this module came from using that tcl script. It's still the
+most powerful seen script, so if you want something that's easier to use than
+a module, get a copy of bseen.tcl.
diff -Nur src/mod/gseen.mod/UPDATES src/mod/gseen.mod/UPDATES
--- src/mod/gseen.mod/UPDATES	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/UPDATES	2002-10-26 13:17:46.000000000 +0200
@@ -0,0 +1,55 @@
+Changes in gseen.mod: (since v1.0.0)
+--------------------
+
+1.1.1
+- fixed "no newline" compilation warnings that appeared on some systems.
+- fixed uninitialized "li" variable in do_seen()
+- fixed lacking compatibility to eggdrop1.4 (confirmation anyone?)
+- new option: hide-secret-chans
+
+1.1.0	(15.6.2001)
+- added multilang support
+- removed static buffers
+- organized data in a binary search tree (much faster)
+- optimized a few other things
+- added settings:
+    - fuzzy-search
+    - max-matches
+    - wildcard-search
+
+1.0.8
+- quiet-seens wasn't working for !seennick
+- added quiet-ai-seens
+- renamed nopub to nopubseens and nolog to noseendata and
+  quietseen to quietseens
+
+1.0.7
+- added compatibility to !channels
+- fixed a bug relating strict-host 0 had some strange effects on
+  !seen requests for users with ~ in their ident
+
+1.0.6
+- fixed a very evil bug that allowed anyone to crash the bot, sorry
+
+1.0.5
+- quietseens wasn't working correctly
+- added support for egg1.5's udef chansets
+
+1.0.4
+- added GPL stuff
+- changed error msg that appears if no gseen file exists
+
+1.0.3
+- readme updates
+- fixed a grammatical error in do_seen
+
+1.0.2
+- bot wanted to free a NULL pointer sometimes
+
+1.0.1
+- !seen without parameter returned stupid results :)
+- fixed little typo in .purgeseens
+- "I found 1 matches..." -> "I found 1 match..."
+
+1.0.0
+- release :)
diff -Nur src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl
--- src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/addons/gseen.selectlang.1.0.0.tcl	2002-10-26 13:18:14.000000000 +0200
@@ -0,0 +1,80 @@
+#####################################################################
+#
+# gseen.selectlang v1.0.0
+#
+# This is a simple script which selects a language based on the 
+# user's host.
+#
+# It only works for /msg commands.
+#
+# If the user is in a channel which has a language defined, gseen's
+# internal functions will override this selection and use the language
+# of the channel instead.
+#
+#####################################################################
+
+
+# Here you can define which language to use for which host.
+# The first part is the mask for the host, and the second part
+# is the language which should be used for this host.
+
+set tld-langs {
+  {"*.de"		"de"}
+  {"*.at"		"de"}
+  {"*.ch"		"de"}
+  {"*.t-dialin.net"	"de"}
+  {"*.t-ipconnect.net"	"de"}
+  {"*.pl"		"pl"}
+  {"*.jp"		"ja"}
+}
+
+#################################################
+
+
+proc selectlang:getlang {uhost} {
+  global tld-langs
+  
+  foreach tld ${tld-langs} {
+    if {[string match [lindex $tld 0] $uhost]} {
+      return [lindex $tld 1]
+    }
+  }
+  return ""
+}
+
+proc sl:rebind {oldtarget newtarget} {
+  foreach binding [binds msg] {
+    if {[lindex $binding 4] == $oldtarget} {
+      unbind [lindex $binding 0] [lindex $binding 1] [lindex $binding 2] [lindex $binding 4]
+      bind [lindex $binding 0] [lindex $binding 1] [lindex $binding 2] $newtarget
+    }
+  }
+}
+
+proc sl:msg:trigger {nick uhost hand rest target} {
+  global default-slang
+  
+  set lang [selectlang:getlang $uhost]
+  set old-slang ${default-slang}
+  if {$lang != ""} {
+    set default-slang $lang
+    putlog "using '$lang'..."
+  }
+  $target $nick $uhost $hand $rest
+  set default-slang ${old-slang}
+}
+
+sl:rebind *msg:seen sl:msg:seen
+proc sl:msg:seen {nick uhost hand rest} {
+  sl:msg:trigger $nick $uhost $hand $rest *msg:seen
+}
+
+sl:rebind *msg:seenstats sl:msg:seenstats
+proc sl:msg:seenstats {nick uhost hand rest} {
+  sl:msg:trigger $nick $uhost $hand $rest *msg:seenstats
+}
+
+sl:rebind *msg:seennick sl:msg:seennick
+proc sl:msg:seennick {nick uhost hand rest} {
+  sl:msg:trigger $nick $uhost $hand $rest *msg:seennick
+}
\ No newline at end of file
diff -Nur src/mod/gseen.mod/ai.c src/mod/gseen.mod/ai.c
--- src/mod/gseen.mod/ai.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/ai.c	2002-10-26 13:17:47.000000000 +0200
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+static int quietaiseens(char *chan)
+{
+  char buf[121], *b;
+
+  Context;
+  strncpy(buf, quiet_ai_seen, 120);
+  buf[120] = 0;
+  b = buf;
+  while (b[0])
+    if (!strcasecmp(chan, newsplit(&b)))
+      return 1;
+#if EGG_IS_MIN_VER(10503)
+  if (ngetudef("quietaiseens", chan))
+    return 1;
+#endif
+  return 0;
+}
+
+static int tcl_pubmseen STDVAR
+{
+  char *nick, *uhost, *hand, *chan, *text;
+  char buf[1024];
+  char *words, *word;
+  seendat *l;
+  int i;
+
+  Context;
+  BADARGS(6, 6, " nick uhost hand chan text");
+  nick = argv[1];
+  uhost = argv[2];
+  hand = argv[3];
+  chan = argv[4];
+  text = argv[5];
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, chan));
+  glob_nick = nick;
+  for (i = 0; i < strlen(text); i++)
+    if (strchr("!?.,\"", text[i]))
+      text[i] = ' ';
+  strncpy(buf, ignore_words, 1023);
+  buf[1023] = 0;
+  words = buf;
+  while (words[0])
+    add_ignoredword(newsplit(&words));
+  strncpy(buf, text, 1023);
+  buf[1023] = 0;
+  words = buf;
+  while (words[0]) {
+    word = newsplit(&words);
+    if (word_is_ignored(word))
+      continue;
+    l = findseen(word);
+    if (l) {
+      if (quietaiseens(chan)) {
+	set_prefix(SLNOTPREFIX);
+        dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix,
+        	do_seen(word, nick, uhost, chan, 0));
+      } else {
+	set_prefix(SLPUBPREFIX);
+        dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", chan, reply_prefix,
+        	do_seen(word, nick, uhost, chan, 0));
+      }
+      add_seenreq(word, nick, uhost, chan, now);
+      free_ignoredwords();
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
+    }
+  }
+  free_ignoredwords();
+  Tcl_AppendResult(irp, "0", NULL);
+  return TCL_OK;
+}
+
+static tcl_cmds mytcls[] =
+{
+  {"*pubm:seen", tcl_pubmseen},
+  {"*chjn:gseen", gseen_chjn},
+  {"*chpt:gseen", gseen_chpt},
+  {0, 0}
+};
+
+static void add_ignoredword(char *word)
+{
+  ignoredword *l, *nl;
+
+  l = ignoredwords;
+  while (l && l->next)
+    l = l->next;
+  nl = nmalloc(sizeof(ignoredword));
+  nl->word = nmalloc(strlen(word) + 1);
+  strcpy(nl->word, word);
+  nl->next = NULL;
+  if (ignoredwords)
+    l->next = nl;
+  else
+    ignoredwords = nl;
+}
+
+static void free_ignoredwords()
+{
+  ignoredword *l, *ll;
+
+  l = ignoredwords;
+  while (l) {
+    ll = l->next;
+    nfree(l->word);
+    nfree(l);
+    l = ll;
+  }
+  ignoredwords = NULL;
+}
+
+static int expmem_ignoredwords()
+{
+  ignoredword *l;
+  int size = 0;
+
+  for (l = ignoredwords; l; l = l->next) {
+    size += sizeof(ignoredword);
+    size += strlen(l->word) + 1;
+  }
+  return size;
+}
+
+static int word_is_ignored(char *word)
+{
+  ignoredword *l;
+
+  for (l = ignoredwords; l; l = l->next)
+    if (!strcasecmp(l->word, word))
+      return 1;
+  return 0;
+}
diff -Nur src/mod/gseen.mod/datahandling.c src/mod/gseen.mod/datahandling.c
--- src/mod/gseen.mod/datahandling.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/datahandling.c	2002-10-26 13:17:48.000000000 +0200
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+
+static void write_seens()
+{
+  seenreq *r;
+  seenreq_by *b;
+  FILE *f;
+  char s[125];
+
+  Context;
+  /* putlog(LOG_MISC, "*", "Saving seen data..."); */
+  if (!gseenfile[0])
+    return;
+  sprintf(s, "%s~new", gseenfile);
+  f = fopen(s, "w");
+  chmod(s, 0600);
+  if (f == NULL) {
+    putlog(LOG_MISC, "*", "ERROR writing gseen file.");
+    return;
+  }
+  fprintf(f, "# gseen data file v1.\n");
+  write_seen_tree_target = f;
+  btree_getall(&seentree, write_seen_tree);
+  for (r = requests; r; r = r->next)
+    for (b = r->by; b; b = b->next)
+      /* @ nick by host chan when */
+      fprintf(f, "@ %s %s %s %s %lu\n", r->nick, b->who, b->host, b->chan,
+              b->when);
+  fclose(f);
+  unlink(gseenfile);
+  movefile(s, gseenfile);
+  /* putlog(LOG_MISC, "*", "Done."); */
+  return;
+}
+
+static void read_seens()
+{
+  FILE *f;
+  char buf[512], *s, *type, *nick, *host, *chan, *msg, *by;
+  time_t when;
+  int spent, iType, i;
+
+  Context;
+  f = fopen(gseenfile, "r");
+  if (f == NULL) {
+    putlog(LOG_MISC, "*", "Can't open gseen file, creating new database...");
+    return;
+  }
+  while (!feof(f)) {
+    buf[0] = 0;
+    s = buf;
+    fgets(s, 511, f);
+    i = strlen(buf);
+    if (buf[i - 1] == '\n')
+      buf[i - 1] = 0;
+    if ((buf[0] == 0) || (buf[0] == '#'))
+      continue;
+    type = newsplit(&s);
+    if (!strcmp(type, "!")) {
+      nick = newsplit(&s);
+      host = newsplit(&s);
+      chan = newsplit(&s);
+      iType = atoi(newsplit(&s));
+      when = (time_t) atoi(newsplit(&s));
+      spent = atoi(newsplit(&s));
+      msg = s;
+      add_seen(iType, nick, host, chan, msg, when, spent);
+    } else if (!strcmp(type, "@")) {
+      nick = newsplit(&s);
+      by = newsplit(&s);
+      host = newsplit(&s);
+      chan = newsplit(&s);
+      when = (time_t) atoi(newsplit(&s));
+      add_seenreq(nick, by, host, chan, when);
+    }
+  }
+  fclose(f);
+  Context;
+  return;
+}
+
+static void purge_seens()
+{
+  seenreq *r, *rr;
+  seenreq_by *b, *bb;
+
+  Context;
+  if (!expire_seens)
+    return;
+  btree_getall_expanded(&seentree, purge_seen_tree);
+  debug0("purge done");
+  r = requests;
+  rr = NULL;
+  while (r) {
+    b = r->by;
+    bb = NULL;
+    while (b) {
+      if ((now - b->when) > (expire_seens * 86400)) {
+        debug2("request for %s from %s has expired.", r->nick, b->who);
+        nfree(b->who);
+        nfree(b->host);
+        nfree(b->chan);
+        if (bb) {
+          bb->next = b->next;
+          nfree(b);
+          b = bb->next;
+        } else {
+          r->by = b->next;
+          nfree(b);
+          b = r->by;
+        }
+      } else {
+        bb = b;
+        b = b->next;
+      }
+    }
+    if (!r->by) {
+      debug1("no further seen requests for %s, deleting", r->nick);
+      nfree(r->nick);
+      if (rr) {
+        rr->next = r->next;
+        nfree(r);
+        r = rr->next;
+      } else {
+        requests = r->next;
+        nfree(r);
+        r = requests;
+      }
+    } else {
+      rr = r;
+      r = r->next;
+    }
+  }
+}
diff -Nur src/mod/gseen.mod/do_seen.c src/mod/gseen.mod/do_seen.c
--- src/mod/gseen.mod/do_seen.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/do_seen.c	2002-10-26 13:17:50.000000000 +0200
@@ -0,0 +1,840 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+/* do_seen(): Checks if someone matches the mask, and returns the reply
+ * mask : first paramater (e.g. "G`Quann", "G`Quann", "*!*@*.isp.de", ...)
+ * nick : nick of the one, who triggered the command
+ * uhost: user@host of nick
+ * chan : chan, where the command was triggered
+ * bns  :
+ *        1 : do a botnet-seen if no matches are found
+ *        0 : don't do a botnet-seen
+ *       -1 : return NULL instead of text, if no matches were found
+ *            (necessary for botnet seen)
+ */
+static char *do_seen(char *mask, char *nick, char *uhost, char *chan, int bns)
+{
+  char hostbuf[UHOSTLEN + 1], *host, *newhost, *tmp, *dur;
+  seendat *l;
+  gseenres *r;
+  int wild, nr;
+  char bnquery[256];
+  struct userrec *u;
+  struct laston_info *li;
+  struct chanset_t *ch;
+
+  Context;
+  start_seentime_calc();
+  if (seen_reply) {
+    nfree(seen_reply);
+    seen_reply = NULL;
+  }
+  l = NULL;
+  li = NULL;
+  host = hostbuf;
+  newhost = NULL;
+  mask = newsplit(&mask);
+  glob_query = mask;
+  while (mask[0] == ' ')
+    mask++;
+  if (!mask[0]) {
+    return SLNOPARAM;
+  }
+  if (strchr(mask, '?') || strchr(mask, '*')) {
+    // if wildcard-searches ares not allowed, then either return
+    // NULL (for botnet-seen), or a appropriate warning
+    if (!wildcard_search) {
+      if (bns == -1)
+        return NULL;
+      else
+        return SLNOWILDCARDS;
+    } else
+      wild = 1;
+  } else {
+    if (strlen(mask) > seen_nick_len) // don't process if requested nick is too long
+      return SLTOOLONGNICK;      // (e.g. stop stupid jokes)
+    if (!strcasecmp(mask, nick)) {
+      return SLMIRROR;
+    }
+    // check if the nick is on the current channel
+    if (onchan(mask, chan))
+      return SLONCHAN;
+    if ((glob_othernick = handonchan(mask, chan)))
+      return SLHANDONCHAN;
+    // check if it is on any other channel
+    if ((ch = onanychan(mask))) {
+#if EGG_IS_MIN_VER(10500)
+      if (!secretchan(ch->dname)) {
+	glob_otherchan = ch->dname;
+        return SLONOTHERCHAN;
+      }
+#else
+      if (!secretchan(ch->name)) {
+	glob_otherchan = ch->name;
+        return SLONOTHERCHAN;
+      }
+#endif
+    }
+    // check if the user who uses this handle is on the channel under
+    // a different nick
+    if ((ch = handonanychan(mask))) {
+#if EGG_IS_MIN_VER(10500)
+      if (!secretchan(ch->dname)) {
+        glob_otherchan = ch->dname;
+        return SLONOTHERCHAN;
+      }
+#else
+      if (!secretchan(ch->name)) {
+        glob_otherchan = ch->name;
+        return SLONOTHERCHAN;
+      }
+#endif
+    }
+    add_seenreq(mask, nick, uhost, chan, now);
+    wild = 0;
+    l = findseen(mask);
+    // if there's a result, and if we don't want to search for the same user
+    // under a different nick, just make a do_seennick on the result
+    if (l && !fuzzy_search) {
+      tmp = do_seennick(l);
+      end_seentime_calc();
+      return tmp;
+    }
+    if (!l) {
+      u = get_user_by_handle(userlist, mask);
+      if (u) {
+        li = get_user(&USERENTRY_LASTON, u);
+      }
+      if (!u || !li) {
+        if (bns == -1) {       // if bns is 0, then do_seen() was triggered by
+          end_seentime_calc(); // a botnet seen function, which needs a clear
+          return NULL;         // NULL to detect if there was a result or not
+        }
+        tmp = SLNOTSEEN;
+        if (bns && ((strlen(mask) + strlen(nick) + strlen(uhost)
+            + strlen(chan) + 20) < 255)) {
+          debug0("trying botnet seen");
+          if (bnsnick)
+            nfree(bnsnick);
+          if (bnschan)
+            nfree(bnschan);
+          bnsnick = nmalloc(strlen(nick) + 1);
+          strcpy(bnsnick, nick);
+          bnschan = nmalloc(strlen(chan) + 1);
+          strcpy(bnschan, chan);
+          sprintf(bnquery, "gseen_req %s %s %s %s", mask, nick, uhost, chan);
+          botnet_send_zapf_broad(-1, botnetnick, NULL, bnquery);
+        }
+      } else {
+        // we have a matching handle, no seen-entry, but a laston entry
+        // in the userbase, so let's just return that one.
+        dur = gseen_duration(now - li->laston);
+        glob_laston = dur;
+        tmp = SLPOORSEEN;
+        seen_reply = nmalloc(strlen(tmp) + 1);
+        strcpy(seen_reply, tmp);
+        end_seentime_calc();
+        return seen_reply;
+      }
+      end_seentime_calc();
+      return tmp;
+    }
+    // now prepare the host for fuzzy-search
+    if (strlen(l->host) < UHOSTLEN) {
+      maskstricthost(l->host, host);
+      host = strchr(host, '!') + 1; // strip nick from host for faster search
+    } else {
+      end_seentime_calc();
+      return "error, too long host";
+    }
+  }
+  if (l && (l->type == SEEN_CHPT)) {
+    tmp = do_seennick(l);
+    end_seentime_calc();
+    return tmp;
+  }
+  numresults = 0;
+  // wildmatch_seens uses a global var to store hosts in it
+  // (to prevent massive nmalloc/nfree-usage), so don't forget
+  // to initialize and free it
+  temp_wildmatch_host = my_malloc(1);
+  wildmatch_seens(host, mask, wild);
+  my_free(temp_wildmatch_host);
+  temp_wildmatch_host = NULL;
+  if (!results) {
+    end_seentime_calc();
+    if (bns == -1)
+      return NULL; // let the botnet seen function know, that seen failed
+    return SLNOMATCH;
+  }
+  if (numresults >= max_matches) {
+    end_seentime_calc();
+    free_seenresults();
+    return SLTOOMANYMATCHES;
+  }
+  sortresults();
+  if (strcasecmp(results->seen->nick, mask)) {
+    // if the user's latest nick is not the nick for which we were searching,
+    // say that there were multiple matches and display the latest one
+    if (numresults == 1)
+      tmp = SLONEMATCH;
+    else if (numresults <= 5)
+      tmp = SLLITTLEMATCHES;
+    else
+      tmp = SLMANYMATCHES;
+    seen_reply = nmalloc(strlen(tmp) + 1);
+    strcpy(seen_reply, tmp);
+    nr = 0;
+    for (r = results; (r && (nr < 5)); r = r->next) {
+      nr++;
+      if (nr > 1) {
+        seen_reply = nrealloc(seen_reply, 1 + strlen(seen_reply) + 1 + strlen(r->seen->nick) + 1);
+        strcat(seen_reply, ", ");
+      } else {
+	seen_reply = nrealloc(seen_reply, 1 + strlen(seen_reply) + strlen(r->seen->nick) + 1);
+        strcat(seen_reply, " ");
+      }
+      strcat(seen_reply, r->seen->nick);
+    }
+    tmp = do_seennick(results->seen);
+    seen_reply = nrealloc(seen_reply, 2 + strlen(seen_reply) + strlen(tmp) + 1);
+    sprintf(seen_reply, "%s. %s", seen_reply, tmp);
+  } else { // first result is the nick which we were searching for
+    // just return the info for this nick and don't care about other results
+    tmp = do_seennick(results->seen);
+    seen_reply = nmalloc(strlen(tmp) + 1);
+    strcpy(seen_reply, tmp);
+  }
+  free_seenresults();
+  end_seentime_calc();
+  return seen_reply;
+}
+
+/* do_seennick():
+ * takes a seen-dataset and produces the corresponding reply basically
+ * by referencing to the lang entry with the same number as the seen-type.
+ */
+static char *do_seennick(seendat *l)
+{
+//  char buf[256], *msg;
+  int stype;
+
+  Context;
+  if (!l) {
+    debug0("ERROR! Tryed to do a seennick on a NULL pointer!");
+    return "ERROR! seendat == NULL!!!";
+  }
+  glob_seendat = l;
+  // l->type is the basic language-entry-number
+  stype = l->type + 100;
+  // in some cases, we might need a special reply, so modify the
+  // number if neccessary
+  switch (l->type) {
+    case SEEN_JOIN:
+      if (!onchan(l->nick, l->chan))
+        stype += 20;
+      break;
+    case SEEN_PART:
+      /* nothing to do here */
+      break;
+    case SEEN_SIGN:
+      /* nothing again */
+      break;
+    case SEEN_NICK:
+      if (!onchan(l->msg, l->chan))
+        stype += 20;
+      break;
+    case SEEN_NCKF:
+      if (!onchan(l->nick, l->chan))
+        stype += 20;
+      break;
+    case SEEN_KICK:
+/*      msg = buf;
+      strncpy(buf, l->msg, 255);
+      msg[255] = 0;
+      sglobpunisher = newsplit(&msg);
+      sglobreason = msg; */
+      break;
+    case SEEN_SPLT:
+      /* nothing to do here */
+      break;
+    case SEEN_REJN:
+      if (!onchan(l->nick, l->chan))
+        stype += 20;
+      break;
+    case SEEN_CHJN:
+    case SEEN_CHPT:
+      if (!strcmp(l->chan, "0"))
+        stype += 20;
+      break;
+    default:
+      stype = 140;
+  }
+  return getslang(stype);
+}
+
+/* findseens():
+ * interface for webseen.mod
+ * find all results for a query and return a pointer to this list
+ * (basically the core of do_seen())
+ */
+static gseenres *findseens(char *mask, int *ret, int fuzzy)
+{
+  char hostbuf[UHOSTLEN + 1], *host, *newhost;
+  seendat *l;
+  int wild;
+
+  Context;
+  start_seentime_calc();
+  *ret = WS_OK;
+  l = NULL;
+  host = hostbuf;
+  newhost = NULL;
+  mask = newsplit(&mask);
+  while (mask[0] == ' ')
+    mask++;
+  if (!mask[0]) {
+    *ret = WS_NOPARAM;
+    return NULL;
+  }
+  if (strchr(mask, '?') || strchr(mask, '*')) {
+    // if wildcard-searches ares not allowed, then either return
+    // NULL (for botnet-seen), or a appropriate warning
+    if (!wildcard_search) {
+      *ret = WS_NOWILDCARDS;
+      return NULL;
+    }
+    wild = 1;
+  } else {
+    if (strlen(mask) > seen_nick_len) { // don't process if requested nick is too long
+      *ret = WS_TOOLONGNICK;       // (e.g. stop stupid jokes)
+      return NULL;
+    }
+    add_seenreq(mask, "www-user", "unknown_host", "webinterface", now);
+    wild = 0;
+    l = findseen(mask);
+    // if there's a result, and if we don't want to search for the same user
+    // under a different nick, just return this result
+    if (l && (!fuzzy_search || !fuzzy)) {
+      numresults = 1;
+      add_seenresult(l);
+      end_seentime_calc();
+      return results;
+    }
+    if (!l) {
+      // no matching user was found :(
+      *ret = WS_NORESULT;
+      end_seentime_calc();
+      return NULL;
+    }
+    // now prepare the host for fuzzy-search
+    if (strlen(l->host) < UHOSTLEN) {
+      maskstricthost(l->host, host);
+      host = strchr(host, '!') + 1; // strip nick from host for faster search
+    } else {
+      *ret = WS_TOOLONGHOST;
+      end_seentime_calc();
+      return NULL;
+    }
+  }
+  if (l && (l->type == SEEN_CHPT)) {
+    numresults = 1;
+    add_seenresult(l);
+    end_seentime_calc();
+    return results;
+  }
+  numresults = 0;
+  // wildmatch_seens uses a global var to store hosts in it
+  // (to prevent massive nmalloc/nfree-usage), so don't forget
+  // to initialize and free it
+  temp_wildmatch_host = my_malloc(1);
+  wildmatch_seens(host, mask, wild);
+  my_free(temp_wildmatch_host);
+  temp_wildmatch_host = NULL;
+  if (!results) {
+    // no match :(
+    *ret = WS_NORESULT;
+    end_seentime_calc();
+    return NULL;
+  }
+  if (numresults >= max_matches) {
+    free_seenresults();
+    *ret = WS_TOOMANYMATCHES;
+    end_seentime_calc();
+    return NULL;
+  }
+  sortresults();
+  *ret = 0;
+  end_seentime_calc();
+  return results;
+}
+
+
+char seenstats_reply[512];
+static char *do_seenstats()
+{
+  glob_totalnicks = count_seens();
+  glob_totalbytes = gseen_expmem();
+  sprintf(seenstats_reply, "%s", SLSEENSTATS);
+  return seenstats_reply;
+}
+
+// add an seen result (to the top of the list)
+static void add_seenresult(seendat *seen)
+{
+  gseenres *nl;
+
+  numresults++;
+  if (numresults > max_matches)
+    return;
+  nl = nmalloc(sizeof(gseenres));
+  nl->seen = seen;
+  nl->next = results;
+  results = nl;
+}
+
+static int expmem_seenresults()
+{
+  int bytes = 0;
+  gseenres *l;
+
+  for (l = results; l; l = l->next)
+    bytes += sizeof(gseenres);
+  return bytes;
+}
+
+static void free_seenresults()
+{
+  gseenres *l, *ll;
+
+  l = results;
+  while (l) {
+    ll = l->next;
+    nfree(l);
+    l = ll;
+  }
+  results = NULL;
+}
+
+static void sortresults()
+{
+  int again = 1;
+  gseenres *last, *p, *c, *n;
+  int a, b;
+
+  Context;
+  again = 1;
+  last = NULL;
+  while ((results != last) && (again)) {
+    p = NULL;
+    c = results;
+    n = c->next;
+    again = 0;
+    while (n != last) {
+      if (!c || !n)
+        a = b = 0;
+      else
+        a = c->seen->when;
+        b = n->seen->when;
+      if (a < b) {
+  again = 1;
+  c->next = n->next;
+  n->next = c;
+  if (p == NULL)
+    results = n;
+  else
+    p->next = n;
+      }
+      p = c;
+      c = n;
+      n = n->next;
+    }
+    last = c;
+  }
+  Context;
+  return;
+}
+
+static void sortrequests(seenreq *l)
+{
+  int again = 1;
+  seenreq_by *last, *p, *c, *n;
+  int a, b;
+
+  Context;
+  again = 1;
+  last = NULL;
+  while ((l->by != last) && (again)) {
+    p = NULL;
+    c = l->by;
+    n = c->next;
+    again = 0;
+    while (n != last) {
+      if (!c || !n)
+        a = b = 0;
+      else
+        a = c->when;
+        b = n->when;
+      if (a < b) {
+  again = 1;
+  c->next = n->next;
+  n->next = c;
+  if (p == NULL)
+    l->by = n;
+  else
+    p->next = n;
+      }
+      p = c;
+      c = n;
+      n = n->next;
+    }
+    last = c;
+  }
+  Context;
+  return;
+}
+
+/* stolen from tcl_duration in tclmisc.c */
+char gs_duration_temp[256];
+static char *gseen_duration(int seconds)
+{
+  char s[256];
+  time_t sec;
+
+  sec = seconds;
+  s[0] = 0;
+  if (sec < 1) {
+    snprintf(gs_duration_temp, sizeof(gs_duration_temp), "%s", SLSOMETIME);
+    return gs_duration_temp;
+  }
+  if (sec < 60) {
+    sprintf(gs_duration_temp, "%d %s", (int) (sec / 1),
+            ((int) (sec / 1) > 1) ? SLSECONDS : SLSECOND);
+    return gs_duration_temp;
+  }
+  if (sec >= 31536000) {
+    sprintf(s, "%d %s ", (int) (sec / 31536000),
+            ((int) (sec / 31536000) > 1) ? SLYEARS : SLYEAR);
+    sec -= (((int) (sec / 31536000)) * 31536000);
+  }
+  if (sec >= 604800) {
+    sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 604800),
+            ((int) (sec / 604800) > 1) ? SLWEEKS : SLWEEK);
+    sec -= (((int) (sec / 604800)) * 604800);
+  }
+  if (sec >= 86400) {
+    sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 86400),
+            ((int) (sec / 86400) > 1) ? SLDAYS : SLDAY);
+    sec -= (((int) (sec / 86400)) * 86400);
+  }
+  if (sec >= 3600) {
+    sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 3600),
+            ((int) (sec / 3600) > 1) ? SLHOURS : SLHOUR);
+    sec -= (((int) (sec / 3600)) * 3600);
+  }
+  if (sec >= 60) {
+    sprintf(&s[strlen(s)], "%d %s ", (int) (sec / 60),
+            ((int) (sec / 60) > 1) ? SLMINUTES : SLMINUTE);
+    sec -= (((int) (sec / 60)) * 60);
+  }
+  strcpy(gs_duration_temp, s);
+  if (gs_duration_temp[strlen(gs_duration_temp) - 1] == ' ')
+    gs_duration_temp[strlen(gs_duration_temp) - 1] = 0;
+  return gs_duration_temp;
+}
+
+static int onchan(char *nick, char *chan)
+{
+  struct chanset_t *ch;
+  memberlist *m;
+
+  ch = findchan_by_dname(chan);
+  if (!ch)
+    return 0;
+  m = ismember(ch, nick);
+  if (!m)
+    return 0;
+  else if (chan_issplit(m))
+    return 0;
+  else
+    return 1;
+}
+
+/* handonchan():
+ * checks if the given user is on the channel and returns its nick
+ */
+static char *handonchan(char *hand, char *chan)
+{
+  struct chanset_t *ch;
+  memberlist *m;
+
+  ch = findchan_by_dname(chan);
+  if (!ch)
+    return 0;
+  if (ch->channel.members > 0) {
+    for (m = ch->channel.member; m; m = m->next) {
+      if (m->user) {
+        if (m->user->handle && !rfc_casecmp(m->user->handle, hand))
+          return m->nick;
+      }
+    }
+  }
+  return NULL;
+}
+
+/* onanychan():
+ * checks if the given nickname is on any of the bot's chans.
+ */
+static struct chanset_t *onanychan(char *nick)
+{
+  struct chanset_t *ch;
+  memberlist *m;
+
+  for (ch = chanset; ch; ch = ch->next) {
+    m = ismember(ch, nick);
+    if (m && !chan_issplit(m))
+      return ch;
+  }
+  return NULL;
+}
+
+/* handonanychan():
+ * checks if the given user is on any channel (no matter under which nick)
+ */
+static struct chanset_t *handonanychan(char *hand)
+{
+  struct chanset_t *ch;
+  memberlist *m;
+
+  for (ch = chanset; ch; ch = ch->next) {
+    if (ch->channel.members > 0) {
+      for (m = ch->channel.member; m; m = m->next) {
+        if (m->user) {
+          if (m->user->handle && !rfc_casecmp(m->user->handle, hand))
+            return ch;
+        }
+      }
+    }
+  }
+  return NULL;
+}
+
+static void add_seenreq(char *nick, char *from, char *host, char *chan,
+			time_t when)
+{
+  seenreq *l, *nl;
+  seenreq_by *b, *nb;
+  char buf[10] = "[secret]";
+
+  Context;
+  if (!tell_seens)
+    return;
+  if (strcmp(chan, "[partyline]") && secretchan(chan))
+    chan = buf;
+  for (l = requests; l; l = l->next) {
+    if (!strcasecmp(nick, l->nick)) {
+      for (b = l->by; b; b = b->next) {
+	if (!strcasecmp(from, b->who)) {
+	  nfree(b->chan);
+	  b->chan = nmalloc(strlen(chan) + 1);
+	  strcpy(b->chan, chan);
+	  b->when = when;
+	  return;
+	}
+      }
+      b = l->by;
+      while (b && b->next)
+        b = b->next;
+      nb = nmalloc(sizeof(seenreq_by));
+      nb->who = nmalloc(strlen(from) + 1);
+      strcpy(nb->who, from);
+      nb->host = nmalloc(strlen(host) + 1);
+      strcpy(nb->host, host);
+      nb->chan = nmalloc(strlen(chan) + 1);
+      strcpy(nb->chan, chan);
+      nb->when = when;
+      nb->next = NULL;
+      if (l->by)
+        b->next = nb;
+      else
+        l->by = nb;
+      return;
+    }
+  }
+  nb = nmalloc(sizeof(seenreq_by));
+  nb->who = nmalloc(strlen(from) + 1);
+  strcpy(nb->who, from);
+  nb->host = nmalloc(strlen(host) + 1);
+  strcpy(nb->host, host);
+  nb->chan = nmalloc(strlen(chan) + 1);
+  strcpy(nb->chan, chan);
+  nb->when = when;
+  nb->next = NULL;
+  l = requests;
+  while (l && l->next)
+    l = l->next;
+  nl = nmalloc(sizeof(seenreq));
+  nl->nick = nmalloc(strlen(nick) + 1);
+  strcpy(nl->nick, nick);
+  nl->by = nb;
+  nl->next = NULL;
+  if (requests)
+    l->next = nl;
+  else
+    requests = nl;
+}
+
+static int expmem_seenreq()
+{
+  seenreq *l;
+  seenreq_by *b;
+  int size;
+
+  size = 0;
+  for (l = requests; l; l = l->next) {
+    size += sizeof(seenreq);
+    size += strlen(l->nick) + 1;
+    for (b = l->by; b; b = b->next) {
+      size += sizeof(seenreq_by);
+      size += strlen(b->who) + 1;
+      size += strlen(b->host) + 1;
+      size += strlen(b->chan) + 1;
+    }
+  }
+  return size;
+}
+
+static int count_seenreq(seenreq_by *b)
+{
+  seenreq_by *l;
+  int nr;
+
+  nr = 0;
+  for (l = b; l; l = l->next)
+    nr++;
+  return nr;
+}
+
+static void free_seenreq()
+{
+  seenreq *l, *ll;
+  seenreq_by *b, *bb;
+
+  Context;
+  l = requests;
+  while (l) {
+    b = l->by;
+    while (b) {
+      bb = b->next;
+      nfree(b->who);
+      nfree(b->host);
+      nfree(b->chan);
+      nfree(b);
+      b = bb;
+    }
+    ll = l->next;
+    nfree(l->nick);
+    nfree(l);
+    l = ll;
+  }
+  requests = NULL;
+}
+
+static void report_seenreq(char *channel, char *nick)
+{
+  seenreq *l, *ll;
+  seenreq_by *b, *bb;
+  char *reply, *tmp;
+  int nr;
+
+  if (!tell_seens)
+    return;
+  ll = NULL;
+  l = requests;
+  reply = NULL;
+  while (l) {
+    if (!strcasecmp(l->nick, nick)) {
+      reset_global_vars();
+      glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel));
+      glob_nick = nick;
+      nr = count_seenreq(l->by);
+      if (nr == 1) {
+        glob_seenrequest = l;
+        dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, SLONELOOK);
+      } else {
+        sortrequests(l);
+        glob_seenrequest = l;
+        glob_seenrequests = nr;
+        tmp = SLMORELOOKS;
+        reply = nmalloc(strlen(tmp) + 1);
+	    strcpy(reply, tmp);
+	    nr = 0;
+        for (b = l->by; b; b = b->next) {
+          nr++;
+          reply = nrealloc(reply, strlen(reply) + ((nr == 1) ? 1 : 2) + strlen(b->who) + 1);
+          sprintf(reply, "%s%s%s", reply, (nr == 1) ? " " : ", ", b->who);
+	    }
+        tmp = SLLASTLOOK;
+        reply = nrealloc(reply, strlen(reply) + 2 + strlen(tmp) + 1);
+        sprintf(reply, "%s. %s", reply, tmp);
+	    dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, reply);
+        nfree(reply);
+      }
+      b = l->by;
+      while (b) {
+        bb = b->next;
+        nfree(b->who);
+        nfree(b->host);
+        nfree(b->chan);
+        nfree(b);
+        b = bb;
+      }
+      nfree(l->nick);
+      if (ll)
+        ll->next = l->next;
+      else
+        requests = l->next;
+      nfree(l);
+      if (ll)
+        l = ll->next;
+      else
+        l = requests;
+    } else {
+      ll = l;
+      l = l->next;
+    }
+  }
+}
+
+static void start_seentime_calc()
+{
+  struct timeval t;
+
+  gettimeofday(&t, NULL);
+  glob_presearch = (float) t.tv_sec + (((float) t.tv_usec) / 1000000);
+}
+
+static void end_seentime_calc()
+{
+  struct timeval t;
+
+  gettimeofday(&t, NULL);
+  glob_aftersearch = (float) t.tv_sec + (((float) t.tv_usec) / 1000000);
+  glob_total_searchtime += glob_aftersearch - glob_presearch;
+  glob_total_queries++;
+}
diff -Nur src/mod/gseen.mod/generic_binary_tree.c src/mod/gseen.mod/generic_binary_tree.c
--- src/mod/gseen.mod/generic_binary_tree.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/generic_binary_tree.c	2002-10-26 13:17:51.000000000 +0200
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#define GENERIC_BINARY_TREE 1
+
+struct generic_binary_tree {
+  void *root;
+  int (*comparedata) (void *data1, void *data2);
+  int (*expmemdata) (void *data);
+  void (*freedata) (void *data);
+};
+
+struct generic_binary_tree_node {
+  void *data;
+  void *left;
+  void *right;
+};
+
+static void btree_add(struct generic_binary_tree *, void *);
+static int btree_expmem(struct generic_binary_tree *);
+static int btree_recursive_expmem(struct generic_binary_tree *, struct generic_binary_tree_node *);
+static void *btree_get(struct generic_binary_tree *, void *t);
+static void btree_freetree(struct generic_binary_tree *);
+static void btree_recursive_free(struct generic_binary_tree *,
+                                 struct generic_binary_tree_node *);
+static void btree_getall(struct generic_binary_tree *, void (*) (void *));
+static void btree_recursive_getall(struct generic_binary_tree_node *,
+                                   void (*) (void *));
+static void btree_getall_expanded(struct generic_binary_tree *tree, void (*) (void *));
+static void btree_recursive_getall_expanded(struct generic_binary_tree_node *,
+                                            void (*) (void *));
+static void btree_remove(struct generic_binary_tree *, void *);
+
+static void btree_add(struct generic_binary_tree *tree, void *data)
+{
+  struct generic_binary_tree_node *node, *lastnode;
+  int cmp, lastcmp;
+
+  Assert(tree);
+  Assert(data);
+  cmp = lastcmp = 0;
+  node = tree->root;
+  lastnode = NULL;
+  while (node) {
+    cmp = tree->comparedata(node->data, data);
+    if (!cmp) {
+      // item is identical -> free old data and insert new
+      tree->freedata(node->data);
+      node->data = data;
+      return;
+    }
+    lastnode = node;
+    lastcmp = cmp;
+    if (cmp < 0)
+      node = node->left;
+    else
+      node = node->right;
+  }
+  node = nmalloc(sizeof(struct generic_binary_tree_node));
+  node->left = NULL;
+  node->right = NULL;
+  node->data = data;
+  if (!lastnode)
+    tree->root = node;
+  else {
+    Assert(lastcmp);
+    if (lastcmp < 0) {
+      Assert(!lastnode->left);
+      lastnode->left = node;
+    } else {
+      Assert(!lastnode->right);
+      lastnode->right = node;
+    }
+  }
+}
+
+static int btree_expmem(struct generic_binary_tree *tree)
+{
+  int size = 0;
+
+  Assert(tree);
+  size += btree_recursive_expmem(tree, tree->root);
+  return size;
+}
+
+static int btree_recursive_expmem(struct generic_binary_tree *tree, struct generic_binary_tree_node *node)
+{
+  int size = 0;
+
+  if (!node)
+    return 0;
+  size += sizeof(struct generic_binary_tree_node);
+  size += tree->expmemdata(node->data);
+  size += btree_recursive_expmem(tree, node->left);
+  size += btree_recursive_expmem(tree, node->right);
+  return size;
+}
+
+static void *btree_get(struct generic_binary_tree *tree, void *what)
+{
+  struct generic_binary_tree_node *node;
+  int cmp;
+
+  node = tree->root;
+  while (node) {
+    cmp = tree->comparedata(node->data, what);
+    if (!cmp)
+      return node->data;
+    if (cmp < 0)
+      node = node->left;
+    else
+      node = node->right;
+  }
+  return NULL;
+}
+
+static void btree_freetree(struct generic_binary_tree *tree)
+{
+  btree_recursive_free(tree, tree->root);
+}
+
+static void btree_recursive_free(struct generic_binary_tree *tree,
+                                 struct generic_binary_tree_node *node)
+{
+  if (!node)
+    return;
+  btree_recursive_free(tree, node->left);
+  btree_recursive_free(tree, node->right);
+  tree->freedata(node->data);
+  nfree(node);
+}
+
+/* btree_getall():
+ * calls the specified function for each item in the tree.
+ * NOTE: getall() calls the proc _before_ it proceeds into recursion. This way,
+ *       one can savely store the tree into a file without mixing up its form.
+ *       But if you delete an item from the called prcedure, this function
+ *       WILL crash. Use btree_getall() expanded instead.
+ */
+static void btree_getall(struct generic_binary_tree *tree, void (*func) (void *))
+{
+  Assert(tree);
+  btree_recursive_getall(tree->root, func);
+}
+
+static void btree_recursive_getall(struct generic_binary_tree_node *node,
+                                   void (*func) (void *))
+{
+  if (!node)
+    return;
+  // first call the function, then proceed into recursion
+  // this way, the tree keeps in form if its saved to a file, for example
+  Assert(func);
+  func(node->data);
+
+  btree_recursive_getall(node->left, func);
+  btree_recursive_getall(node->right, func);
+}
+
+/* btree_getall_expanded():
+ * the same as btree_getall(), but calls the function after the greatest level of recursion
+ * has been reached. The node-pointers won't be accessed anymore when the first function
+ * gets called. You can savely use this to free items.
+ */
+static void btree_getall_expanded(struct generic_binary_tree *tree, void (*func) (void *))
+{
+  Assert(tree);
+  btree_recursive_getall_expanded(tree->root, func);
+}
+
+static void btree_recursive_getall_expanded(struct generic_binary_tree_node *node,
+                                            void (*func) (void *))
+{
+  if (!node)
+    return;
+  btree_recursive_getall_expanded(node->left, func);
+  btree_recursive_getall_expanded(node->right, func);
+
+  Assert(func);
+  func(node->data);
+}
+
+static void btree_remove(struct generic_binary_tree *tree, void *data)
+{
+  struct generic_binary_tree_node *node, *last, *largenode, *lastlarge;
+  int ret, lastret;
+
+  Assert(tree);
+  Assert(data);
+  last = NULL;
+  lastret = 0;
+  node = tree->root;
+  while (node) {
+    ret = tree->comparedata(node->data, data);
+    if (ret == 0)
+      break;
+    last = node;
+    lastret = ret;
+    if (ret < 0)
+      node = node->left;
+    else
+      node = node->right;
+  }
+  if (!node)  // oops, item not found
+    return;
+  if (!node->left && !node->right) {
+    // *freu* no sub-branches! We can easily delete this item.
+    if (last) {
+      if (lastret < 0)
+        last->left = NULL;
+      else
+        last->right = NULL;
+    } else
+      tree->root = NULL;
+  } else if (!node->left) {
+    // also pretty easy. Just connect the child to the parent.
+    if (last) {
+      if (lastret < 0)
+        last->left = node->right;
+      else
+        last->right = node->right;
+    } else
+      tree->root = node->right;
+  } else if (!node->right) {
+    // same as above, but mirrored
+    if (last) {
+      if (lastret < 0)
+        last->left = node->left;
+      else
+        last->right = node->left;
+    } else
+      tree->root = node->left;
+  } else {
+    // aaargh... two sub-trees! The world is not fair... *sigh*
+    debug0("argl... worst case, two subtrees. :( Let's pray...");
+    // now we take the largest item from the left subtree and replace the
+    // doomed node with it.
+    // since it is the largest val, the tree remains valid and doesn't
+    // get deformed too much.
+
+    // at first, we have to find this node and cut it from the tree
+    largenode = node->left;
+    lastlarge = NULL;
+    while (largenode && largenode->right) {
+      lastlarge = largenode;
+      largenode = largenode->right;
+    }
+
+    // only set largenode->left to node->left if largenode exists.
+    // otherwise node->left points to largenode, which would result
+    // in a nice short-circuit
+    // If it does not exist, just leave largenode->left as it is because we just
+    // move largenode one level up, so it can keep its left subtree.
+    if (lastlarge) {
+      lastlarge->right = largenode->left;
+      largenode->left = node->left;
+    }
+
+    // now connect node's subtrees to it
+    largenode->right = node->right;
+
+    // and finally replace node with largenode
+    if (last) {
+      if (lastret < 0)
+        last->left = largenode;
+      else
+        last->right = largenode;
+    } else
+      tree->root = largenode;
+  }
+  // finally kill the node... we shouldn't need it anymore
+  tree->freedata(node->data);
+  nfree(node);
+  node = NULL;
+}
+
+#ifdef BTREE_WITHOPTIMIZE
+static void btree_optimize(struct generic_binary_tree *tree,
+                           struct generic_binary_tree_node *node,
+                           struct generic_binary_tree_node *last,
+                           int limit)
+{
+/*  int leftdepth, rightdepth;
+
+  if (!node)
+    return;
+  btree_optimize(tree, node->left, node, last, limit);
+  btree_optimize(tree, node->right, node, last, limit);
+  leftdepth = btree_depth(node->left);
+  rightdepth = btree_depth(node->right);
+  if ((leftdepth - rightdepth) > limit) {
+
+  }
+*/
+}
+#endif
diff -Nur src/mod/gseen.mod/global_vars.c src/mod/gseen.mod/global_vars.c
--- src/mod/gseen.mod/global_vars.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/global_vars.c	2002-10-26 13:18:09.000000000 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+static char *glob_query, *glob_laston, *glob_otherchan, *glob_othernick;
+static char *glob_remotebot, *glob_nick;
+static struct slang_header *glob_slang;
+static seendat *glob_seendat;
+static seenreq *glob_seenrequest;
+static int glob_seenrequests, glob_totalnicks, glob_totalbytes;
+
+static void reset_global_vars()
+{
+  glob_query = glob_laston = glob_otherchan = glob_othernick = NULL;
+  glob_remotebot = glob_nick = NULL;
+  glob_seendat = NULL;
+  glob_slang = NULL;
+  glob_seenrequest = NULL;
+  glob_seenrequests = glob_totalnicks = glob_totalbytes = 0;
+}
diff -Nur src/mod/gseen.mod/gseen.c src/mod/gseen.mod/gseen.c
--- src/mod/gseen.mod/gseen.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/gseen.c	2002-10-26 14:24:48.000000000 +0200
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#define MAKING_GSEEN
+#define MODULE_NAME "gseen"
+#define MODULE_VERSION "1.1.1 dev3"
+#define MODULE_NUMVERSION 10100
+#include "../module.h"
+#include "../irc.mod/irc.h"
+#include "../server.mod/server.h"
+#include "../channels.mod/channels.h"
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <time.h> /* for time_t */
+
+#undef global
+static Function *global = NULL, *irc_funcs = NULL, *server_funcs = NULL, *channels_funcs = NULL;
+
+#ifndef EGG_IS_MIN_VER
+#define EGG_IS_MIN_VER(ver)             ((ver) <= 10400)
+#endif
+
+#ifndef EGG_IS_MAX_VER
+#define EGG_IS_MAX_VER(ver)		((ver) >= 10400)
+#endif
+
+#ifndef Context
+#define Context context
+#endif
+
+#ifndef findchan_by_dname
+#define findchan_by_dname findchan
+#endif
+
+#include "gseen.h"
+#include "seenlang.h"
+
+static struct slang_header *coreslangs = NULL;
+static gseenres *results = NULL;
+static seenreq *requests = NULL;
+static ignoredword *ignoredwords = NULL;
+static char *bnsnick = NULL;
+static char *bnschan = NULL;
+static char *seen_reply = NULL;
+static char *temp_wildmatch_host;
+static int numresults = 0;
+static double glob_presearch, glob_aftersearch;
+int numseens, glob_total_queries;
+double glob_total_searchtime;
+
+static char gseenfile[121] = "gseen.dat";
+static char no_pub[121];
+static char quiet_seen[121];
+static char quiet_ai_seen[121];
+static char no_log[121];
+static char ignore_words[1024];
+static char default_slang[21] = "eng";
+static int gseen_numversion = MODULE_NUMVERSION;
+static int save_seens = 60;
+static int save_seens_temp = 1;
+static int expire_seens = 60;
+static int maxseen_thr = 0;
+static int maxseen_time = 0;
+static int seenflood_thr = 0;
+static time_t seenflood_time = 0;
+static int use_handles = 0;
+static int tell_seens = 1;
+static int botnet_seen = 1;
+int fuzzy_search = 1;          // search for the same user under a differnt nick
+static int wildcard_search = 1;// allow wildcard seaching? ("*!*@*.isp.de")
+static int max_matches = 500;  // break if there are more than X matches
+static int hide_secret_chans = 1;	// #chan (+secret) => [secret]
+static int seen_nick_len = 32;
+
+#include "global_vars.c"
+#define SLANG_NOTYPES 1
+#define SLANG_NOFACTS 1
+#define SLANG_NOGETALL 1
+#define SLANG_NOVALIDATE 1
+#include "slang.c"
+#include "slang_gseen_commands.c"
+#include "generic_binary_tree.c"
+#include "seentree.c"
+#include "datahandling.c"
+#include "sensors.c"
+#include "do_seen.c"
+#include "gseencmds.c"
+#include "ai.c"
+#include "misc.c"
+#include "tclcmds.c"
+
+static int gseen_expmem()
+{
+  int size = 0;
+
+  size += seentree_expmem();
+  size += expmem_seenresults();
+  size += expmem_seenreq();
+  size += expmem_ignoredwords();
+  size += slang_expmem(coreslangs);
+  size += slang_glob_expmem();
+  size += slang_chanlang_expmem(chanlangs);
+  if (bnsnick)
+    size += strlen(bnsnick) + 1;
+  if (bnschan)
+    size += strlen(bnschan) + 1;
+  if (seen_reply) {
+    size += strlen(seen_reply) + 1;
+  }
+  return size;
+}
+
+static void free_gseen()
+{
+  seentree_free();
+  slang_free(coreslangs);
+  slang_chanlang_free(chanlangs);
+  if (seen_reply)
+    nfree(seen_reply);
+  return;
+}
+
+/* a report on the module status */
+static void gseen_report(int idx, int details)
+{
+  int size = 0;
+
+  Context;
+  if (details) {
+    size = gseen_expmem();
+    dprintf(idx, "    using %d bytes\n", size);
+  }
+}
+
+static void gseen_minutely ()
+{
+  if (save_seens_temp >= save_seens) {
+    write_seens();
+    save_seens_temp = 1;
+  } else
+    save_seens_temp++;
+}
+
+static void gseen_daily ()
+{
+  Context;
+  purge_seens();
+}
+
+static tcl_strings my_tcl_strings[] =
+{
+  {"gseenfile", gseenfile, 121, 0},
+  {"ai-seen-ignore", ignore_words, 1024, 0},
+  {"no-pub-seens", no_pub, 121, 0},
+  {"quiet-seens", quiet_seen, 121, 0},
+  {"quiet-ai-seens", quiet_ai_seen, 121, 0},
+  {"no-log", no_log, 121, 0},
+  {"no-seendata", no_log, 121, 0},
+  {"default-slang", default_slang, 20, 0},
+  {0, 0, 0, 0}
+};
+
+static tcl_ints my_tcl_ints[] =
+{
+  {"save-seens", &save_seens, 0},
+  {"expire-seens", &expire_seens, 0},
+  {"use-handles", &use_handles, 0},
+  {"tell-seens", &tell_seens, 0},
+  {"botnet-seens", &botnet_seen, 0},
+  {"max-matches", &max_matches, 0},
+  {"fuzzy-search", &fuzzy_search, 0},
+  {"wildcard-search", &wildcard_search, 0},
+  {"hide-secret-chans", &hide_secret_chans, 0},
+  {"seen-nick-len", &seen_nick_len, 0},
+  {0, 0, 0}
+};
+
+static tcl_coups my_tcl_coups[] =
+{
+  {"max-seens", &maxseen_thr, &maxseen_time},
+  {0, 0, 0},
+};
+
+static char *gseen_close()
+{
+  Context;
+  write_seens();
+  slang_glob_free();
+  free_gseen();
+  free_seenreq();
+  free_seenresults();
+  free_ignoredwords();
+  if (bnsnick)
+    nfree(bnsnick);
+  if (bnschan)
+    nfree(bnschan);
+  rem_tcl_strings(my_tcl_strings);
+  rem_tcl_ints(my_tcl_ints);
+  rem_tcl_coups(my_tcl_coups);
+  rem_tcl_commands(mytcls);
+  rem_tcl_commands(gseentcls);
+  rem_tcl_commands(seendebugtcls);
+  rem_tcl_commands(gseentcls);
+  rem_builtins(H_dcc, mydcc);
+  rem_builtins(H_join, seen_join);
+  rem_builtins(H_kick, seen_kick);
+  rem_builtins(H_nick, seen_nick);
+  rem_builtins(H_part, seen_part);
+  rem_builtins(H_sign, seen_sign);
+  rem_builtins(H_splt, seen_splt);
+  rem_builtins(H_rejn, seen_rejn);
+  rem_builtins(H_pub, seen_pub);
+  rem_builtins(H_msg, seen_msg);
+  rem_builtins(H_bot, seen_bot);
+  del_hook(HOOK_MINUTELY, (Function) gseen_minutely);
+  del_hook(HOOK_DAILY, (Function) gseen_daily);
+  module_undepend(MODULE_NAME);
+  return NULL;
+}
+
+char *gseen_start();
+
+static Function gseen_table[] =
+{
+  (Function) gseen_start,
+  (Function) gseen_close,
+  (Function) gseen_expmem,
+  (Function) gseen_report,
+  /* 4 - 7 */
+  (Function) findseens,
+  (Function) free_seenresults,
+  (Function) gseen_duration,
+  (Function) & glob_seendat,
+  (Function) & numresults,
+  (Function) & fuzzy_search,
+  (Function) & numseens,
+  (Function) & glob_total_queries,
+  (Function) & glob_total_searchtime,
+  (Function) & gseen_numversion,
+};
+
+char *gseen_start(Function * global_funcs)
+{
+  global = global_funcs;
+  Context;
+  module_register(MODULE_NAME, gseen_table, 1, 1);
+  if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0)))
+    return "You need the irc module to use the gseen module.";
+  if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0)))
+    return "You need the server module to use the gseen module.";
+  if (!(channels_funcs = module_depend(MODULE_NAME, "channels", 1, 0)))
+    return "You need the channels module to use the gseen module.";
+  if (!module_depend(MODULE_NAME, "eggdrop", 107, 0)) {
+    if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) {
+      if (!module_depend(MODULE_NAME, "eggdrop", 105, 0)) {
+        if (!module_depend(MODULE_NAME, "eggdrop", 104, 0)) {
+          module_undepend(MODULE_NAME);
+          return "This module requires eggdrop1.4.0 or later";
+        }
+      }
+    }
+  }
+  chanlangs = NULL;
+  coreslangs = NULL;
+  slang_glob_init();
+
+  results = NULL;
+  requests = NULL;
+  ignoredwords = NULL;
+  bnsnick = NULL;
+  bnschan = NULL;
+  seen_reply = NULL;
+
+  numresults = 0;
+  numseens = 0;
+  glob_total_queries = 0;
+  glob_total_searchtime = 0.0;
+  ignore_words[0] = 0;
+  no_pub[0] = 0;
+  quiet_seen[0] = 0;
+  no_log[0] = 0;
+  seentree_init();
+  add_tcl_strings(my_tcl_strings);
+  add_tcl_ints(my_tcl_ints);
+  add_tcl_coups(my_tcl_coups);
+  add_tcl_commands(mytcls);
+  add_tcl_commands(seendebugtcls);
+  add_tcl_commands(gseentcls);
+  add_builtins(H_dcc, mydcc);
+  add_builtins(H_join, seen_join);
+  add_builtins(H_kick, seen_kick);
+  add_builtins(H_nick, seen_nick);
+  add_builtins(H_part, seen_part);
+  add_builtins(H_sign, seen_sign);
+  add_builtins(H_sign, seen_sign);
+  add_builtins(H_splt, seen_splt);
+  add_builtins(H_rejn, seen_rejn);
+  add_builtins(H_pub, seen_pub);
+  add_builtins(H_msg, seen_msg);
+  add_builtins(H_bot, seen_bot);
+  read_seens();
+  add_hook(HOOK_MINUTELY, (Function) gseen_minutely);
+  add_hook(HOOK_DAILY, (Function) gseen_daily);
+#if EGG_IS_MIN_VER(10503)
+  initudef(1, "noseendata", 1);
+  initudef(1, "quietseens", 1);
+  initudef(1, "quietaiseens", 1);
+  initudef(1, "nopubseens", 1);
+#endif
+  glob_slang_cmd_list = slang_commands_list_add(glob_slang_cmd_list, slang_text_gseen_command_table);
+  putlog(LOG_MISC, "*", "gseen.mod v%s loaded.", MODULE_VERSION);
+  return NULL;
+}
diff -Nur src/mod/gseen.mod/gseen.conf src/mod/gseen.mod/gseen.conf
--- src/mod/gseen.mod/gseen.conf	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/gseen.conf	2002-10-26 13:17:54.000000000 +0200
@@ -0,0 +1,147 @@
+
+######
+#####
+###   General Settings
+#####
+######
+
+# the file where the seen data will be backuped.
+# WARNING: set this _before_ the module is loaded.
+set gseenfile "gseen.dat"
+
+# now load the module
+loadmodule gseen
+
+# load the English language file
+loadseenslang "en" "English" language/gseen.en.lang
+
+# load the German language file
+loadseenslang "de" "Deutsch" language/gseen.de.lang
+
+# set the default language to english...
+set default-slang "en"
+
+# ... but let #xwp use the german langfile
+setchanseenlang #xwp "de"
+
+# the char that marks public commands (!seen, etc...)
+# "" is a valid option
+set cmdchar "!"
+
+# delete data sets that are older than x days
+set expire-seens 60
+
+# only answer x seen requests in y seconds to prevent flooding
+set max-seens 7:60
+
+# tell users if someone was !seen'ing for them
+set tell-seens 1
+
+# check if the user was online under a different nick
+set fuzzy-search 1
+
+# allow user to include wildcards in the search?
+set wildcard-search 1
+
+# break search if there are more than x matches
+set max-matches 250
+
+# forward a request to other bots, if a !seen returned no result?
+set botnet-seens 1
+
+# store channels, which are +secret on the bot as [secret]?
+set hide-secret-chans 1
+
+# backup the seen data every x minutes
+set save-seens 60
+
+######
+#####
+###   AI Settings
+#####
+######
+
+# this setting configures on which sentences your bot should
+# attempt to do an ai-seen. Each of them is a simple wildcard
+# mask. Set this to "" if you want to deactivate ai-seens or
+# create more precise masks if the bots reacts too often.
+set ai-seen-binds {
+  "${nick}*seen*"
+  "${botnet-nick}*seen*"
+  "${nick}*gesehen*"
+  "${botnet-nick}*gesehen*"
+}
+
+# this is just the same as above, but if triggered it will
+# not do an ai-seen, but display its seen-stats.
+set ai-seenstats-binds {
+  "${nick}*seenstats*"
+  "${botnet-nick}*seenstats*"
+}
+
+# when doing an AI seen, ignore the following words (otherwise
+# the bot might give weird answers like "<bot> nick, bot was last seen..." :)
+set ai-seen-ignore "$nick ${botnet-nick} seen"
+
+######
+#####
+###   special stuff (can be ignored in most cases)
+#####
+######
+
+# if the user is known by the bot, log their handle instead of the nick
+# (not recommended, might cause confusion by the users)
+set use-handles 0
+
+######
+#####
+###   outdated settings (only important for eggdropv1.4 users)
+#####
+######
+
+# channels where you do not want your bot to reply to public queries
+set no-pub-seens ""
+
+# channels where you want your bot to send replies via notice to the user and
+# not to the channel
+set quiet-seens ""
+
+# same as quiet-seens but for AI seen
+set quiet-ai-seens ""
+
+# channels where you do not want your bot to log seen data
+set no-seendata ""
+
+
+###############################################################################
+# end of configuration
+# just ignore everything below ^_^
+###############################################################################
+
+bind chjn - * *chjn:gseen
+bind chpt - * *chpt:gseen
+
+catch "unbind pub - !seen *pub:!seen"
+catch "unbind pub - !seennick *pub:!seennick"
+catch "unbind pub - !seenstats *pub:!seenstats"
+bind pub - ${cmdchar}seen *pub:!seen
+bind pub - ${cmdchar}seennick *pub:!seennick
+bind pub - ${cmdchar}seenstats *pub:!seenstats
+
+foreach bnd [binds pubm] {
+  if {([lindex $bnd 2] == "*pubm:seen") || ([lindex $bnd 2] == "*pub:!seenstats")} {
+    unbind [lindex $bnd 0] [lindex $bnd 1] [lindex $bnd 2] [lindex $bnd 4]
+  }
+}
+
+if {${ai-seen-binds} != ""} {
+  foreach mask ${ai-seen-binds} {
+    bind pubm -|- "% [subst $mask]" *pubm:seen
+  }
+}
+
+if {${ai-seenstats-binds} != ""} {
+  foreach mask ${ai-seenstats-binds} {
+    bind pubm -|- "% [subst $mask]" *pub:!seenstats
+  }
+}
diff -Nur src/mod/gseen.mod/language/gseen.de.lang src/mod/gseen.mod/language/gseen.de.lang
--- src/mod/gseen.mod/language/gseen.de.lang	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/language/gseen.de.lang	2002-10-26 13:18:12.000000000 +0200
@@ -0,0 +1,131 @@
+#####################################################################
+#
+# Deutsche Sprachdatei für GSeen.Mod v1.1.0
+#
+# Der Text in dieser Datei kann nach belieben verändert werden. Du
+# kannst Tags hinzufügen oder entfernen, wie es Dir gefällt. Die Tags
+# müssen nicht in einer bestimmten Reihenfolge oder Anzahl vorkommen.
+#
+# Wenn Du mehr als eine Zeile pro ID angibst, dann wird bei der
+# Antwort per Zufall eine daraus ausgewählt. (das funktioniert nicht
+# bei den Zeiteinheiten)
+#
+# Falls Du denkst, daß hier noch ein paar wichtige Tags fehlen, dann
+# schick mir einfach eine email. Vielleicht füge ich sie dann in der
+# nächsten Version hinzu.
+#
+# Eine komplette Liste der Verfügbaren Tags befindet sich am Ende von
+# slang_gseen_commands.c (leider ohne Erklährungen)
+#
+#####################################################################
+
+#
+## Zeiteinheiten
+#
+# jeweils in Singular und Plural
+#
+D 0 Jahr
+D 1 Jahre
+D 2 Woche
+D 3 Wochen
+D 4 Tag
+D 5 Tage
+D 6 Stunde
+D 7 Stunden
+D 8 Minute
+D 9 Minuten
+D 10 Sekunde
+D 11 Sekunden
+# falls ein üngültiger Zeitwert angegeben war, dann wird dieser Text ausgegeben:
+D 12 einiger Zeit
+
+
+#
+## Präfixe
+#
+# Dieses Fragment wird jeweils vor eine Antwort gesetzt. Dadurch
+# ist beispielsweise bei öffentlichen Anfragen ersichtlich, für
+# wen die Antwort ist.
+# Achtung: Die Nummer muss auf jeden Fall definiert werden. Sie muss
+#	   zwar keinen Text beinhalten, aber wenn sie nicht vorhanden
+#	   ist, dann gibt es eine Fehlermeldung
+
+# für Antworten, die in den Channel geschrieben werden:
+10 <?nick/?>, 
+# für Antworten, die per NOTICE an den User geschickt werden:
+11
+# für Antworten auf Anfragen, die per "/msg <bot> seen" erfolgt sind:
+12
+# und für Antworten auf der Partyline:
+13
+
+#
+## Fehlermeldungen
+#
+54 weißt Du was ein Parameter ist? ^_^
+54 ich würde Dir ja gerne helfen, aber solange Du nicht sagst, nach wem Du suchst, kann ich nicht viel tun.
+54 meinst Du nicht, es wäre geschickter zu sagen, nach wem Du überhaupt suchst?
+54 42.
+55 sehe ich etwa wie ein Spiegel aus? ^_^
+55 Spieglein, Spieglein an der Wand...
+55 leidest Du etwa unter multiplen Persönlichkeiten? *eg*
+56 also wenn Du <?query/?> jetzt hier nicht sehen kannst, dann brauchst Du sicherlich eine neue Brille ^_^
+56 ich muss mir unbedingt mal die Tarnkappe von <?query/?> ausleihen. Scheint ja prima zu funktioneren.
+56 schau Dir bitte nochmal ganz genau an, wer grade alles im Channel ist.
+57 Tut mir leid, aber Wildcards ('?', oder '*') sind bei der Suche nicht erlaubt.
+58 Öhm... naja... etwas arg lang, dieser Nick... :)
+
+#
+## Kein Ergebnis
+#
+65 Ich kann mich nicht daran erinnern, <?query/?> gesehen zu haben...
+65 <?query/?>? Hmm... ich bin mir nicht sicher... vielleicht... eventuell... nein, kenne ich nicht.
+65 der Name sagt mir nichts. Hast Du Dich vielleicht vertippt?
+66 Ich hab' <?query/?> seit <?laston/?> nicht mehr gesehen.
+67 Sorry, aber zu deiner Anfrage passt nichts in meiner Datenbank :(
+68 Autschi, das gab viel zu viele Ergebnisse. Bitte formuliere deine Suche etwas genauer.
+
+73 <?query/?> ist grade unter dem Nick "<?othernick/?>" in diesem Channel zu finden.
+74 <?query/?> ist gerade in <?otherchan/?>.
+75 Deine Anfrage führte zu genau einem Ergebnis:
+76 Immerhin <?numresults/?> Treffer ergab deine Anfrage:
+77 Wow, auf deine Anfrage passen sogar <?numresults/?> Einträge in meiner Datenbank! Dies sind die 5 aktuellsten:
+
+#
+## falls ein anderer Bot etwas gefunden hat:
+#
+85 <?remotebot/?> sagt: 
+
+#
+## die eigentliche Information
+#
+101 Ich habe <?snick/?> (<?shost/?>) zuletzt <?schan/?> vor <?swhen/?> betreten sehen (<?stime/?>). <?snick/?> ist noch immer da.
+121 Ich habe <?snick/?> (<?shost/?>) zuletzt <?schan/?> vor <?swhen/?> betreten sehen (<?stime/?>), aber <?snick/?> verschwand mysteriöserweise.
+102 Ich habe <?snick/?> (<?shost/?>) zuletzt <?schan/?> vor <?swhen/?> nach <?spent/?> verchatteter Zeit verlassen sehen (<?stime/?>)
+103 Ich habe <?snick/?> (<?shost/?>) zuletzt in <?schan/?> gesehen, als er/sie vor <?swhen/?> (<?stime/?>) nach <?spent/?> das IRC verließ ("<?smsg/?>").
+104 Zuletzt habe ich <?snick/?> (<?shost/?>) vor <?swhen/?> in <?schan/?> gesehen, den Nick zu <?snick2/?> wechselnd. <?snick2/?> ist noch immer dort.
+124 <?snick/?> (<?shost/?>) was last seen changing his/her nick to <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick2/?> mysteriously dematerialized.
+105 Zuletzt habe ich <?snick/?> (<?shost/?>) vor <?swhen/?> in <?schan/?> gesehen, den Nick von <?snick2/?> wechselnd. <?snick/?> ist noch immer dort.
+125 <?snick/?> (<?shost/?>) was last seen changing his/her nick from <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick/?> mysteriously dematerialized.
+106 Zuletzt habe ich <?snick/?> (<?shost/?>) gesehen, als er vor <?swhen/?> (<?stime/?>) von <?punisher/?> aus <?schan/?> gejagt wurde. (<?kickreason/?>)
+107 <?snick/?> (<?shost/?>) habe ich zuletzt vor <?swhen/?> gesehen, als er/sie von <?schan/?> aus in einem Netsplit verschwand.
+108 <?snick/?> (<?shost/?>) habe ich zuletzt vor <?swhen/?> gesehen, als er/sie nach einem Netsplit in <?schan/?> zurück kam. <?snick/?> ist noch immer dort.
+128 <?snick/?> (<?shost/?>) habe ich zuletzt vor <?swhen/?> gesehen, als er/sie nach einem Netsplit in <?schan/?> zurück kam. Allerdings konnte <?snick/?> dem Gott der Netsplits nicht endgültig entkommen und ist wieder verschollen...
+109 <?snick/?> was last seen joining the botnet channel <?schan/?> on <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+129 <?snick/?> was last seen joining the partyline on <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+110 <?snick/?> was last seen leaving the botnet channel <?schan/?> from <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+130 <?snick/?> was last seen leaving the partyline from <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+140 <?snick/?> (<?shost/?>) was last seen on <?schan/?> <?swhen/?> ago (<?stime/?>).
+
+#
+## Seen-Mitteilungen
+#
+170 <?rnick/?> (<?rhost/?>) scheint vor <?rwhen/?> (<?rtime/?>) in <?rchan/?> auf der Suche nach Dir gewesen zu sein.
+171 <?requests/?> Leute haben sich nach Dir erkundigt:
+172 Der/die letzte war <?rnick/?> (<?rhost/?>) in <?rchan/?> vor <?rwhen/?> (<?rtime/?>).
+
+#
+## Statistiken
+#
+180 Momentan sind <?totalnicks/?> Nicks in meiner Datenbank. Gesamter Speicherverbrauch: <?totalbytes/?> Bytes
+180 In meiner Datenbank befinden sich <?totalnicks/?> Nicks und verbrauchen <?totalbytes/?> Bytes Speicher.
diff -Nur src/mod/gseen.mod/language/gseen.en.lang src/mod/gseen.mod/language/gseen.en.lang
--- src/mod/gseen.mod/language/gseen.en.lang	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/language/gseen.en.lang	2002-10-26 13:18:13.000000000 +0200
@@ -0,0 +1,131 @@
+#####################################################################
+#
+# Default English langfile for GSeen.Mod v1.1.0
+#
+# Just edit the text below to fit your needs. You can add or remove
+# any tag just like you want, they do not need to appear in a special
+# order (or number).
+#
+# If you enter more than one line per ID, then a random one will be
+# chosen for each reply. (this does not work for the time strings)
+#
+# If you think you need more tags, just email me and maybe I'll add
+# them in the next release.
+#
+# A complete list of available Tags can be found at the end of the
+# file slang_gseen_commands.c (unfortunately, it does not contain any
+# descriptions for the tags)
+#
+#####################################################################
+
+#
+## time string
+#
+# each time string in singular and plural
+#
+D 0 year
+D 1 years
+D 2 week
+D 3 weeks
+D 4 day
+D 5 days
+D 6 hour
+D 7 hours
+D 8 minute
+D 9 minutes
+D 10 second
+D 11 seconds
+# if an invalid time value was supplied, output the following string
+D 12 some time
+
+#
+## Prefixes
+#
+# These are the prefixes of the replies. By default, there's only
+# a prefix for public requests (so you know for whom the answer is),
+# but you can also define prefixes for other requests.
+
+# for replies in the channel:
+10 <?nick/?>, 
+# for replies via notice:
+11
+# for replies via PRIVMSG
+12
+# for replies on the partyline
+13
+
+#
+## error messages
+#
+54 do you know what a parameter is?
+54 don't you think it would be more reasonable to say for whom you are searching?
+54 42.
+55 do I look like a mirror? ^_^
+55 mirror mirror on the wall...
+55 do you have a split personality? *eg*
+56 if you can't see <?query/?> here right now, you probably need new glasses. ^_^
+56 please look a bit closer at the memberlist of this channel.
+57 I'm sorry, but wildcards ('?' or '*') are not allowed in a search.
+58 Hum... don't you think this nick is a bit long? ^_^
+58 you know that the length of nicks is limited, don't you?
+
+#
+## no result
+#
+65 I don't remember seeing <?query/?>.
+65 <?query/?>? hmm... I'm trying to remember... maybe... I'm not sure... no. I don't remember <?query/?>.
+66 I haven't seen <?query/?> for <?laston/?>.
+67 I found no matches to your query.
+67 I'm sorry, but your search didn't return any results.
+68 Ouch, your search returned way too many matches. Please refine it.
+
+#
+## victim is online
+#
+73 <?query/?> is <?othernick/?>, who is on this channel right now.
+74 <?query/?> is on <?otherchan/?> right now.
+
+#
+## results found
+#
+75 I found one match to your query:
+76 I found <?numresults/?> matches to your query:
+77 I found <?numresults/?> matches to your query. These are the 5 most recent ones:
+
+#
+## results found by another bot in the botnet
+#
+85 <?remotebot/?> says: 
+
+#
+## the core info
+#
+101 <?snick/?> (<?shost/?>) was last seen joining <?schan/?> <?swhen/?> ago (<?stime/?>). <?snick/?> is still there.
+121 <?snick/?> (<?shost/?>) was last seen joining <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick/?> mysteriously dematerialized.
+102 <?snick/?> (<?shost/?>) was last seen parting <?schan/?> <?swhen/?> ago (<?stime/?>), after spending <?spent/?> there.
+103 <?snick/?> (<?shost/?>) was last seen quitting <?schan/?> <?swhen/?> ago (<?stime/?>) stating "<?smsg/?>" after spending <?spent/?> there.
+104 <?snick/?> (<?shost/?>) was last seen changing his/her nick to <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>). <?snick2/?> is still there.
+124 <?snick/?> (<?shost/?>) was last seen changing his/her nick to <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick2/?> mysteriously dematerialized.
+105 <?snick/?> (<?shost/?>) was last seen changing his/her nick from <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>). <?snick/?> is still there.
+125 <?snick/?> (<?shost/?>) was last seen changing his/her nick from <?snick2/?> on <?schan/?> <?swhen/?> ago (<?stime/?>), but <?snick/?> mysteriously dematerialized.
+106 <?snick/?> (<?shost/?>) was last seen being kicked from <?schan/?> by <?punisher/?> (<?kickreason/?>) <?swhen/?> ago (<?stime/?>), after spending <?spent/?> there.
+107 <?snick/?> (<?shost/?>) was last seen splitting from <?schan/?> <?swhen/?> ago (<?stime/?>), after spending <?spent/?> there.
+108 <?snick/?> (<?shost/?>) was last seen rejoining <?schan/?> from a netsplit <?swhen/?> ago (<?stime/?>) <?snick/?> is still there.
+128 <?snick/?> (<?shost/?>) was last seen rejoining <?schan/?> from a netsplit <?swhen/?> ago (<?stime/?>), but the god of netsplits didn't let him escape, so he's not here now.
+109 <?snick/?> was last seen joining the botnet channel <?schan/?> on <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+129 <?snick/?> was last seen joining the partyline on <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+110 <?snick/?> was last seen leaving the botnet channel <?schan/?> from <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+130 <?snick/?> was last seen leaving the partyline from <?bnbot/?> <?swhen/?> ago (<?stime/?>).
+140 <?snick/?> (<?shost/?>) was last seen on <?schan/?> <?swhen/?> ago (<?stime/?>).
+
+#
+## seen notification
+#
+170 <?rnick/?> (<?rhost/?>) was looking for you on <?rchan/?> <?rwhen/?> ago (<?rtime/?>).
+171 There have been <?requests/?> users looking for you:
+172 The last one was <?rnick/?> (<?rhost/?>) on <?rchan/?> <?rwhen/?> ago (<?rtime/?>).
+
+#
+## seen stats
+#
+180 I'm currently tracking <?totalnicks/?> nicks using <?totalbytes/?> bytes.
diff -Nur src/mod/gseen.mod/gseen.h src/mod/gseen.mod/gseen.h
--- src/mod/gseen.mod/gseen.h	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/gseen.h	2002-10-26 13:17:55.000000000 +0200
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+/* #define USE_MEMDEBUG 1 */
+
+#define SEEN_JOIN 1
+#define SEEN_PART 2
+#define SEEN_SIGN 3
+#define SEEN_NICK 4
+#define SEEN_NCKF 5
+#define SEEN_KICK 6
+#define SEEN_SPLT 7
+#define SEEN_REJN 8
+#define SEEN_CHPT 9
+#define SEEN_CHJN 10
+
+typedef struct gseen_data {
+  int type;
+  char *nick;
+  char *host;
+  char *chan;
+  char *msg;
+  time_t when;
+  int spent;
+} seendat;
+
+typedef struct gseen_result {
+  struct gseen_result *next;
+  seendat *seen;
+} gseenres;
+
+typedef struct gseen_requests {
+  struct gseen_requests *next;
+  char *who;
+  char *host;
+  char *chan;
+  time_t when;
+} seenreq_by;
+
+typedef struct gseen_request {
+  struct gseen_request *next;
+  char *nick;
+  struct gseen_requests *by;
+} seenreq;
+
+typedef struct gseen_ignorewords {
+  struct gseen_ignorewords *next;
+  char *word;
+} ignoredword;
+
+#ifdef MAKING_GSEEN
+static int gseen_expmem();
+static void free_gseen();
+static int get_spent(char *, char *);
+static void write_seens();
+static void read_seens();
+static char *do_seen(char *, char *, char *, char *, int);
+static void add_seenresult(seendat *);
+static int expmem_seenresults();
+static void free_seenresults();
+static void sortresults();
+static char *do_seennick(seendat *);
+static int onchan(char *, char *);
+static char *handonchan(char *, char *);
+static struct chanset_t *onanychan(char *);
+static struct chanset_t *handonanychan(char *);
+static char *do_seenstats();
+static void add_seenreq(char *, char *, char *, char *, time_t);
+static int expmem_seenreq();
+static void free_seenreq();
+static void sortrequests(seenreq *);
+static void report_seenreq(char *, char *);
+static int count_seenreq(seenreq_by *b);
+static int expmem_ignoredwords();
+static void free_ignoredwords();
+static void add_ignoredword(char *word);
+static int word_is_ignored(char *word);
+static void purge_seens();
+static int seenflood();
+static int secretchan(char *);
+static int nopub(char *);
+static int quietseen(char *);
+static int quietaiseens(char *);
+static int nolog(char *);
+static void start_seentime_calc();
+static void end_seentime_calc();
+#endif
+
+
+#ifdef MAKING_GSEEN
+
+// tree stuff
+static void maskstricthost(const char *, char *);
+#endif
+
+// interface for webseen
+#define WS_OK 0
+#define WS_NORESULT 1
+#define WS_NOPARAM 2
+#define WS_NOWILDCARDS 3
+#define WS_TOOLONGNICK 4
+#define WS_TOOMANYMATCHES 5
+#define WS_TOOLONGHOST 6
+
+#ifndef MAKING_GSEEN
+#define findseens ((gseenres *(*)(char *, int *, int))gseen_funcs[4])
+#define free_seenresults ((void (*)())gseen_funcs[5])
+#define gseen_duration ((char *(*)(int))gseen_funcs[6])
+#define numresults (*(int *)(gseen_funcs[12]))
+#define fuzzy_search (*(int *)(gseen_funcs[13]))
+#define numseens (*(int *)(gseen_funcs[15]))
+#define glob_total_queries (*(int *)(gseen_funcs[16]))
+#define glob_total_searchtime (*(double *)(gseen_funcs[17]))
+#define gseen_numversion (*(int *)(gseen_funcs[19]))
+#else
+static gseenres *findseens(char *, int *, int);
+static char *gseen_duration(int);
+#endif
+
+#ifdef MAKING_GSEEN
+
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef free
+#undef free
+#endif
+#ifdef realloc
+#undef realloc
+#endif
+
+#ifdef USE_MEMDEBUG
+#define my_malloc nmalloc
+#define my_free nfree
+#define my_realloc nrealloc
+#else
+#define my_malloc malloc
+#define my_free free
+#define my_realloc realloc
+#endif
+
+#endif
diff -Nur src/mod/gseen.mod/gseencmds.c src/mod/gseen.mod/gseencmds.c
--- src/mod/gseen.mod/gseencmds.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/gseencmds.c	2002-10-26 13:17:56.000000000 +0200
@@ -0,0 +1,420 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#define PREFIX_LENGTH 20
+
+static char reply_prefix[PREFIX_LENGTH + 1];
+#define set_prefix(x) strncpy(reply_prefix, x, PREFIX_LENGTH); \
+	reply_prefix[PREFIX_LENGTH] = 0;
+
+static int seenflood()
+{
+  if (!maxseen_thr || !maxseen_time)
+    return 0;
+  if ((now - seenflood_time) > maxseen_time) {
+    seenflood_time = now;
+    seenflood_thr = 0;
+  }
+  seenflood_thr++;
+  if (seenflood_thr > maxseen_thr)
+    return 1;
+  else
+    return 0;
+}
+
+static int nopub(char *chan)
+{
+  char buf[121], *b;
+
+  Context;
+  strncpy(buf, no_pub, 120);
+  buf[120] = 0;
+  b = buf;
+  while (b[0])
+    if (!strcasecmp(chan, newsplit(&b)))
+      return 1;
+#if EGG_IS_MIN_VER(10503)
+  if (ngetudef("nopubseens", chan))
+    return 1;
+#endif
+  return 0;
+}
+
+static int quietseen(char *chan)
+{
+  char buf[121], *b;
+
+  Context;
+  strncpy(buf, quiet_seen, 120);
+  buf[120] = 0;
+  b = buf;
+  while (b[0])
+    if (!strcasecmp(chan, newsplit(&b)))
+      return 1;
+#if EGG_IS_MIN_VER(10503)
+  if (ngetudef("quietseens", chan))
+    return 1;
+#endif
+  return 0;
+}
+
+static int cmd_seen(struct userrec *u, int idx, char *par)
+{
+  char *query;
+  
+  Context;
+  if (seenflood())
+    return 0;
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, default_slang);
+  glob_nick = dcc[idx].nick;
+  query = newsplit(&par);
+  glob_query = query;
+  set_prefix(SLDCCPREFIX);
+  putlog(LOG_CMDS, "*", "#%s# seen %s", dcc[idx].nick, par);
+  dprintf(idx, "%s%s\n", reply_prefix, do_seen(query, dcc[idx].nick,
+  	  dcc[idx].host, "[partyline]", botnet_seen));
+  return 0;
+}
+
+static int cmd_seenstats(struct userrec *u, int idx, char *par)
+{
+  Context;
+  if (seenflood())
+    return 0;
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, default_slang);
+  glob_nick = dcc[idx].nick;
+  set_prefix(SLDCCPREFIX);
+  putlog(LOG_CMDS, "*", "#%s# seenstats", dcc[idx].nick);
+  dprintf(idx, "%s%s\n", reply_prefix, do_seenstats());
+  return 0;
+}
+
+static int cmd_purgeseens(struct userrec *u, int idx, char *par)
+{
+  Context;
+  purge_seens();
+  putlog(LOG_CMDS, "*", "#%s# purgeseens", dcc[idx].nick);
+  return 0;
+}
+
+static int pub_seen(char *nick, char *host, char *hand,
+        char *channel, char *text)
+{
+  char *dest;
+#if EGG_IS_MIN_VER(10500)
+  struct chanset_t *chan;
+#endif
+
+  Context;
+  if (seenflood() || nopub(channel))
+    return 0;
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel));
+  glob_nick = nick;
+  putlog(LOG_CMDS, "*", "<<%s>> !%s! seen %s", nick, hand, text);
+  if (quietseen(channel)) {
+    set_prefix(SLNOTPREFIX);
+    dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix,
+           do_seen(newsplit(&text), nick, host, channel, botnet_seen));
+    return 0;
+  }
+#if EGG_IS_MIN_VER(10500)
+  chan = findchan_by_dname(channel);
+  if (chan)
+    dest = chan->name;
+  else
+    dest = channel;
+#else
+  dest = channel;
+#endif
+  set_prefix(SLPUBPREFIX);
+  dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix,
+  	  do_seen(newsplit(&text), nick, host, channel, botnet_seen));
+  return 0;
+}
+
+static int pub_seenstats(char *nick, char *host, char *hand,
+        char *channel, char *text)
+{
+  char *dest;
+#if EGG_IS_MIN_VER(10500)
+  struct chanset_t *chan;
+#endif
+
+  Context;
+  if (seenflood())
+    return 0;
+  if (nopub(channel))
+    return 0;
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel));
+  glob_nick = nick;
+  putlog(LOG_CMDS, "*", "<<%s>> !%s! seenstats", nick, hand);
+  if (quietseen(channel)) {
+    set_prefix(SLNOTPREFIX);
+    dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, do_seenstats());
+    return 0;
+  }
+#if EGG_IS_MIN_VER(10500)
+  chan = findchan_by_dname(channel);
+  if (chan)
+    dest = chan->name;
+  else
+    dest = channel;
+#else
+  dest = channel;
+#endif
+  set_prefix(SLPUBPREFIX);
+  dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix, do_seenstats());
+  return 1;
+}
+
+static int msg_seen(char *nick, char *uhost, struct userrec *u, char *text)
+{
+  Context;
+  if (seenflood())
+    return 0;
+  reset_global_vars();
+  glob_slang = slang_getbynick(coreslangs, nick);
+  glob_nick = nick;
+  putlog(LOG_CMDS, "*", "(%s!%s) !%s! seen %s", nick, uhost, u ? u->handle : "*", text);
+  set_prefix(SLMSGPREFIX);
+  dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", nick, reply_prefix,
+  	  do_seen(newsplit(&text), nick, uhost, "[/msg]", botnet_seen));
+  return 1;
+}
+
+static int pub_seennick(char *nick, char *host, char *hand,
+        char *channel, char *text)
+{
+  seendat *l;
+  char *dest;
+#if EGG_IS_MIN_VER(10500)
+  struct chanset_t *chan;
+#endif
+
+  Context;
+  if (seenflood())
+    return 0;
+  if (nopub(channel))
+    return 0;
+  putlog(LOG_CMDS, "*", "<<%s>> !%s! seennick %s", nick, hand, text);
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, channel));
+  glob_nick = nick;
+#if EGG_IS_MIN_VER(10500)
+  chan = findchan_by_dname(channel);
+  if (chan)
+    dest = chan->name;
+  else
+    dest = channel;
+#else
+  dest = channel;
+#endif
+  text = newsplit(&text);
+  l = findseen(text);
+  if (!l) {
+    glob_query = text;
+    if (quietseen(channel)) {
+      set_prefix(SLNOTPREFIX);
+      dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, SLNOTSEEN);
+    } else {
+      set_prefix(SLPUBPREFIX);
+      dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix, SLNOTSEEN);
+    }
+    return 0;
+  }
+  if (quietseen(channel)) {
+    set_prefix(SLNOTPREFIX);
+    dprintf(DP_HELP, "NOTICE %s :%s%s\n", nick, reply_prefix, do_seennick(l));
+  } else {
+    set_prefix(SLPUBPREFIX);
+    dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", dest, reply_prefix, do_seennick(l));
+  }
+  return 0;
+}
+
+static int msg_seennick(char *nick, char *uhost, struct userrec *u, char *text)
+{
+  seendat *l;
+
+  Context;
+  if (seenflood())
+    return 0;
+  putlog(LOG_CMDS, "*", "(%s!%s) !%s! seennick %s", nick, uhost, u ? u->handle : "*", text);
+  reset_global_vars();
+  glob_slang = slang_getbynick(coreslangs, nick);
+  glob_nick = nick;
+  set_prefix(SLMSGPREFIX);
+  text = newsplit(&text);
+  l = findseen(text);
+  if (!l) {
+    glob_query = text;
+    dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", nick, reply_prefix, SLNOTSEEN);
+    return 0;
+  }
+  dprintf(DP_HELP, "PRIVMSG %s :%s%s\n", nick, reply_prefix, do_seennick(l));
+  return 0;
+}
+
+static int cmd_seennick(struct userrec *u, int idx, char *text)
+{
+  seendat *l;
+
+  Context;
+  if (seenflood())
+    return 0;
+  putlog(LOG_CMDS, "*", "#%s# seennick %s", dcc[idx].nick, text);
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, default_slang);
+  glob_nick = dcc[idx].nick;
+  set_prefix(SLMSGPREFIX);
+  text = newsplit(&text);
+  l = findseen(text);
+  if (!l) {
+    glob_query = text;
+    dprintf(idx, "%s%s\n", reply_prefix, SLNOTSEEN);
+    return 0;
+  }
+  dprintf(idx, "%s%s\n", reply_prefix, do_seennick(l));
+  return 0;
+}
+
+static int bot_gseen_req(char *bot, char *code, char *par)
+{
+  char *mask, *nick, *uhost, *chan, *reply;
+  char tosend[256];
+  int i;
+
+  Context;
+  if (seenflood())
+    return 0;
+  i = nextbot(bot);
+  if (i < 0) {
+    debug1("Couldn't answer botnet-seen-request from %s: no such bot", bot);
+    return 0;
+  }
+  mask = newsplit(&par);
+  nick = newsplit(&par);
+  uhost = newsplit(&par);
+  chan = newsplit(&par);
+  reset_global_vars();
+  glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, chan));
+  glob_nick = nick;
+  reply = do_seen(mask, nick, uhost, chan, -1);
+  if (!reply)
+    return 0;
+  if ((strlen(nick) + strlen(chan) + strlen(reply)) < 255) {
+    sprintf(tosend, "gseen_rep %s %s %s", nick, chan, reply);
+    botnet_send_zapf(i, botnetnick, bot, tosend);
+  }
+  return 0;
+}
+
+static int bot_gseen_rep(char *bot, char *code, char *par)
+{
+  char *nick, *chan, *reply;
+  int i;
+
+  Context;
+  if (seenflood())
+    return 0;
+  if (!bnsnick || !bnschan) {
+    if (bnsnick)
+      nfree(bnsnick);
+    if (bnschan)
+      nfree(bnschan);
+    bnsnick = bnschan = NULL;
+    return 0;
+  }
+  nick = newsplit(&par);
+  chan = newsplit(&par);
+  reset_global_vars();
+  glob_remotebot = bot;
+  glob_slang = slang_find(coreslangs, slang_chanlang_get(chanlangs, chan));
+  glob_nick = nick;
+  reply = par;
+  if (strcmp(nick, bnsnick) || strcmp(chan, bnschan))
+    return 0; /* unwanted reply */
+  if (findchan(chan)) {
+    if (nopub(chan)) {
+      nfree(bnsnick);
+      nfree(bnschan);
+      bnsnick = bnschan = NULL;
+      debug1("%s is nopub, bns-reply dropped", chan);
+      return 0;
+    }
+    if (quietseen(chan)) {
+      set_prefix(SLNOTPREFIX);
+      dprintf(DP_HELP, "NOTICE %s :%s%s%s\n", nick, reply_prefix, SLRBOTSAYS, reply);
+    } else {
+      set_prefix(SLPUBPREFIX);
+      dprintf(DP_HELP, "PRIVMSG %s :%s%s%s\n", chan, reply_prefix, SLRBOTSAYS, reply);
+    }
+  } else if (!strcmp(chan, "[/msg]")) {
+    set_prefix(SLMSGPREFIX);
+    dprintf(DP_HELP, "PRIVMSG %s :%s%s%s\n", nick, reply_prefix, SLRBOTSAYS, reply);
+  } else if (!strcmp(chan, "[partyline]")) {
+    for (i = 0; i < dcc_total; i++) {
+      if ((!strcasecmp(nick, dcc[i].nick)) &&
+         (dcc[i].type->flags & DCT_SIMUL)) {
+	set_prefix(SLDCCPREFIX);
+        dprintf(i, "%s%s%s\n", reply_prefix, SLRBOTSAYS, reply);
+        break;
+      }
+    }
+  } else
+    debug1("Couldn't send received bns answer, no such chan %s", chan);
+  nfree(bnsnick);
+  nfree(bnschan);
+  bnsnick = bnschan = NULL;
+  return 0;
+}
+
+static cmd_t mydcc[] =
+{
+  {"seen", "-|-", cmd_seen, NULL},
+  {"seenstats", "-|-", cmd_seenstats, NULL},
+  {"purgeseens", "m", cmd_purgeseens, NULL},
+  {"seennick", "-|-", cmd_seennick, NULL},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_pub[] =
+{
+  {"!seen", "", pub_seen, 0},
+  {"!seenstats", "", pub_seenstats, 0},
+  {"!seennick", "", pub_seennick, 0},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_msg[] =
+{
+  {"seen", "", msg_seen, 0},
+  {"seennick", "", msg_seennick, 0},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_bot[] =
+{
+  {"gseen_req", "", bot_gseen_req, 0},
+  {"gseen_rep", "", bot_gseen_rep, 0},
+  {0, 0, 0, 0}
+};
diff -Nur src/mod/gseen.mod/misc.c src/mod/gseen.mod/misc.c
--- src/mod/gseen.mod/misc.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/misc.c	2002-10-26 13:17:57.000000000 +0200
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+/* maskstricthost():
+ * basically the same as maskhost() from src/misc.c, but _never_ stripts
+ * "~+-^=" off the host
+ * maskhost() version: * $Id: misc.c,v 1.30 2000/10/27 19:27:32 fabian Exp $
+ */
+static void maskstricthost(const char *s, char *nw)
+{
+  register const char *p, *q, *e, *f;
+  int i;
+
+  *nw++ = '*';
+  *nw++ = '!';
+  p = (q = strchr(s, '!')) ? q + 1 : s;
+  /* Strip of any nick, if a username is found, use last 8 chars */
+  if ((q = strchr(p, '@'))) {
+    int fl = 0;
+
+    if ((q - p) > 9) {
+      nw[0] = '*';
+      p = q - 7;
+      i = 1;
+    } else
+      i = 0;
+    while (*p != '@') {
+      if (!fl && strchr("~+-^=", *p)) {
+//        if (strict_host)
+      nw[i] = '?';
+//    else
+//      i--;
+      } else
+    nw[i] = *p;
+      fl++;
+      p++;
+      i++;
+    }
+    nw[i++] = '@';
+    q++;
+  } else {
+    nw[0] = '*';
+    nw[1] = '@';
+    i = 2;
+    q = s;
+  }
+  nw += i;
+  e = NULL;
+  /* Now q points to the hostname, i point to where to put the mask */
+  if ((!(p = strchr(q, '.')) || !(e = strchr(p + 1, '.'))) && !strchr(q, ':'))
+    /* TLD or 2 part host */
+    strcpy(nw, q);
+  else {
+    if (e == NULL) {        /* IPv6 address?        */
+      const char *mask_str;
+
+      f = strrchr(q, ':');
+      if (strchr(f, '.')) { /* IPv4 wrapped in an IPv6? */
+    f = strrchr(f, '.');
+    mask_str = ".*";
+      } else            /* ... no, true IPv6.       */
+    mask_str = ":*";
+      strncpy(nw, q, f - q);
+      /* No need to nw[f-q] = 0 here, as the strcpy below will
+       * terminate the string for us.
+       */
+      nw += (f - q);
+      strcpy(nw, mask_str);
+    } else {
+      for (f = e; *f; f++);
+      f--;
+      if (*f >= '0' && *f <= '9') { /* Numeric IP address */
+    while (*f != '.')
+      f--;
+    strncpy(nw, q, f - q);
+    /* No need to nw[f-q] = 0 here, as the strcpy below will
+     * terminate the string for us.
+     */
+    nw += (f - q);
+    strcpy(nw, ".*");
+      } else {              /* Normal host >= 3 parts */
+    /*    a.b.c  -> *.b.c
+     *    a.b.c.d ->  *.b.c.d if tld is a country (2 chars)
+     *             OR   *.c.d if tld is com/edu/etc (3 chars)
+     *    a.b.c.d.e -> *.c.d.e   etc
+     */
+    const char *x = strchr(e + 1, '.');
+
+    if (!x)
+      x = p;
+    else if (strchr(x + 1, '.'))
+      x = e;
+    else if (strlen(x) == 3)
+      x = p;
+    else
+      x = e;
+    sprintf(nw, "*%s", x);
+      }
+    }
+  }
+}
diff -Nur src/mod/gseen.mod/seenlang.h src/mod/gseen.mod/seenlang.h
--- src/mod/gseen.mod/seenlang.h	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/seenlang.h	2002-10-26 13:17:58.000000000 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#define SLPUBPREFIX	getslang(10)
+#define SLNOTPREFIX	getslang(11)
+#define SLMSGPREFIX	getslang(12)
+#define SLDCCPREFIX	getslang(13)
+
+#define SLNOPARAM       getslang(54)
+#define SLMIRROR        getslang(55)
+#define SLONCHAN        getslang(56)
+#define SLNOWILDCARDS   getslang(57)
+#define SLTOOLONGNICK   getslang(58)
+
+#define SLNOTSEEN       getslang(65)
+#define SLPOORSEEN      getslang(66)
+#define SLNOMATCH       getslang(67)
+#define SLTOOMANYMATCHES getslang(68)
+
+#define SLHANDONCHAN    getslang(73)
+#define SLONOTHERCHAN   getslang(74)
+#define SLONEMATCH      getslang(75)
+#define SLLITTLEMATCHES getslang(76)
+#define SLMANYMATCHES   getslang(77)
+
+#define SLRBOTSAYS      getslang(85)
+
+#define SLYEAR          getdur(0)
+#define SLYEARS         getdur(1)
+#define SLWEEK          getdur(2)
+#define SLWEEKS         getdur(3)
+#define SLDAY           getdur(4)
+#define SLDAYS          getdur(5)
+#define SLHOUR          getdur(6)
+#define SLHOURS         getdur(7)
+#define SLMINUTE        getdur(8)
+#define SLMINUTES       getdur(9)
+#define SLSECOND        getdur(10)
+#define SLSECONDS       getdur(11)
+#define SLSOMETIME      getdur(12)
+
+#define SLONELOOK       getslang(170)
+#define SLMORELOOKS     getslang(171)
+#define SLLASTLOOK      getslang(172)
+
+#define SLSEENSTATS     getslang(180)
diff -Nur src/mod/gseen.mod/seentree.c src/mod/gseen.mod/seentree.c
--- src/mod/gseen.mod/seentree.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/seentree.c	2002-10-26 13:18:10.000000000 +0200
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+static struct generic_binary_tree seentree;
+
+static void seentree_init();
+static int seentree_expmem();
+static void seentree_free();
+static int compareseens(void *, void *);
+static int expmemseen(void *);
+static void add_seen(int, char *, char *, char *, char *,
+                     time_t, int);
+static void freeseen(void *);
+static seendat *findseen(char *);
+static void wildmatch_seens(char *, char *, int);
+static void process_wildmatch_seens(void *);
+static void write_seen_tree(void *);
+static void purge_seen_tree(void *);
+static int count_seens();
+static void _count_seens(void *);
+
+
+static void seentree_init()
+{
+  seentree.root = NULL;
+  seentree.comparedata = compareseens;
+  seentree.expmemdata = expmemseen;
+  seentree.freedata = freeseen;
+}
+
+static int seentree_expmem()
+{
+  return btree_expmem(&seentree);
+}
+
+static void seentree_free()
+{
+  btree_freetree(&seentree);
+  seentree.root = NULL;
+}
+
+static int compareseens(void *first, void *second)
+{
+  return rfc_casecmp(((seendat *) first)->nick, ((seendat *) second)->nick);
+}
+
+// add another entry to the tree
+static void add_seen(int type, char *nick, char *host, char *chan, char *msg,
+                     time_t when, int spent)
+{
+  seendat *newseen;
+
+  newseen = nmalloc(sizeof(seendat));
+  newseen->type = type;
+  newseen->nick = nmalloc(strlen(nick) + 1);
+  strcpy(newseen->nick, nick);
+  newseen->host = nmalloc(strlen(host) + 1);
+  strcpy(newseen->host, host);
+  newseen->chan = nmalloc(strlen(chan) + 1);
+  strcpy(newseen->chan, chan);
+  newseen->msg = nmalloc(strlen(msg) + 1);
+  strcpy(newseen->msg, msg);
+  newseen->when = when;
+  newseen->spent = spent;
+  btree_add(&seentree, newseen);
+}
+
+static void freeseen(void *what)
+{
+  seendat *s = (seendat *) what;
+  
+  Assert(s);
+  Assert(s->nick);
+  Assert(s->host);
+  Assert(s->chan);
+  Assert(s->msg);
+
+  nfree(s->nick);
+  nfree(s->host);
+  nfree(s->chan);
+  nfree(s->msg);
+  nfree(s);
+}
+
+static int expmemseen(void *what)
+{
+  int size = 0;
+  seendat *d = (seendat *) what;
+  
+  size += sizeof(seendat);
+  size += strlen(d->nick) + 1;
+  size += strlen(d->host) + 1;
+  size += strlen(d->chan) + 1;
+  size += strlen(d->msg) + 1;
+  return size;
+}
+
+// finds a seen entry in the tree
+seendat findseen_temp;
+static seendat *findseen(char *nick)
+{
+  findseen_temp.nick = nick;
+  return btree_get(&seentree, &findseen_temp);
+}
+
+// function to find all nicks that match a host
+// (calls btree_getall() which calls a target function for each item)
+// host: user's hostmask (used if search query doesn't contain any wildcards)
+// mask: search mask
+// wild: defines if we want to use the mask, or host for the search
+static char *wildmatch_host, *wildmatch_mask;
+int wildmatch_wild;
+static void wildmatch_seens(char *host, char *mask, int wild)
+{
+  wildmatch_host = host;
+  wildmatch_mask = mask;
+  wildmatch_wild = wild;
+  btree_getall(&seentree, process_wildmatch_seens);
+}
+
+/* process_wildmatch_seens():
+ * gets called from the binary tree for each existing item.
+ */
+static void process_wildmatch_seens(void *data)
+{
+  seendat *s = (seendat *) data;
+  
+  if ((numresults > max_matches) && (max_matches > 0)) // Don't return too many
+    return;                                            // matches...
+  if (!wildmatch_wild) {
+    if (wild_match(wildmatch_host, s->host))
+      add_seenresult(s);
+  } else {
+    temp_wildmatch_host = my_realloc(temp_wildmatch_host, strlen(s->nick) + 1 + strlen(s->host) + 1);
+    strcpy(temp_wildmatch_host, s->nick);
+    strcat(temp_wildmatch_host, "!");
+    strcat(temp_wildmatch_host, s->host);
+    if (wild_match(wildmatch_mask, s->nick) || wild_match(wildmatch_mask, temp_wildmatch_host))
+      add_seenresult(s);
+  }
+}
+
+// write seendata in the datafile
+FILE *write_seen_tree_target;
+static void write_seen_tree(void *data)
+{
+  seendat *node = (seendat *) data;
+  
+  /* format: "! nick host chan type when spent msg" */
+  fprintf(write_seen_tree_target, "! %s %s %s %d %lu %d %s\n", node->nick,
+          node->host, node->chan, node->type, node->when, node->spent,
+          node->msg);
+}
+
+// recursive function to remove old data
+// QUESTION: What happens if one of the nodes get moved by killseen()?
+//           Possible bug/crash?
+//           I think it should not be a problem. When killseen() is called the
+//           first time, recursion already reached its end and no pointers
+//           are accessed anymore. But I'm not sure... maybe I'm wrong.
+static void purge_seen_tree(void *data)
+{
+  seendat *node = (seendat *) data;
+  
+  if ((now - node->when) > (expire_seens * 86400)) {
+    debug1("seen data for %s has expired.", node->nick);
+    btree_remove(&seentree, node);
+  }
+}
+
+// counts the number of nicks in the database
+static int count_seens_temp;
+static int count_seens()
+{
+  count_seens_temp = 0;
+  btree_getall(&seentree, _count_seens);
+  return count_seens_temp;
+}
+
+static void _count_seens(void *node)
+{
+  count_seens_temp++;
+}
+
+static int tcl_killseen STDVAR
+{
+  Context;
+  BADARGS(2, 2, " nick");
+  findseen_temp.nick = argv[1];
+  btree_remove(&seentree, &findseen_temp);
+  return TCL_OK;
+}
+
+static tcl_cmds seendebugtcls[] =
+{
+  {"killseen", tcl_killseen},
+  {0, 0}
+};
diff -Nur src/mod/gseen.mod/sensors.c src/mod/gseen.mod/sensors.c
--- src/mod/gseen.mod/sensors.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/sensors.c	2002-10-26 13:18:00.000000000 +0200
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+static int get_spent(char *nick, char *chan)
+{
+  struct chanset_t *ch = NULL;
+  memberlist *m = NULL;
+
+  int spent;
+  ch = findchan_by_dname(chan);
+  if (ch)
+    m = ismember(ch, nick);
+  if (m && m->joined)
+    spent = now - m->joined;
+  else
+    spent = -1;
+  return spent;
+}
+
+static int secretchan(char *chan)
+{
+  struct chanset_t *ch;
+
+  ch = findchan_by_dname(chan);
+  if (!ch)
+    return 0;
+  if (ch->status & CHAN_SECRET)
+    return 1;
+  return 0;
+}
+
+static int nolog(char *chan)
+{
+  char buf[121], *b;
+
+  Context;
+  strncpy(buf, no_log, 120);
+  buf[120] = 0;
+  b = buf;
+  while (b[0])
+    if (!strcasecmp(chan, newsplit(&b)))
+      return 1;
+#if EGG_IS_MIN_VER(10503)
+  if (ngetudef("noseendata", chan))
+    return 1;
+#endif
+  return 0;
+}
+
+static int gseen_join(char *nick, char *uhost, char *hand, char *chan)
+{
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  if (secretchan(chan))
+    chan = buf;
+  add_seen(SEEN_JOIN, nick, uhost, chan, "", now, get_spent(nick, chan));
+  report_seenreq(chan, nick);
+  if ((hand[0] == '*') && strcasecmp(nick, hand))
+    report_seenreq(chan, hand);
+  return 0;
+}
+
+static int gseen_kick(char *nick, char *uhost, char *hand, char *chan,
+		       char *victim, char *reason)
+{
+  struct chanset_t *ch = NULL;
+  memberlist *m = NULL;
+  char msg[1024], *s;
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  ch = findchan_by_dname(chan);
+  if (!ch) {
+    debug2("Unable to seen %s getting kicked from %s", victim, chan);
+    return 0;
+  }
+  if (secretchan(chan))
+    chan = buf;
+  s = msg;
+  s[0] = 0;
+  m = ismember(ch, victim);
+  if (!m) {
+    debug2("Unable to seen %s getting kicked from %s", victim, chan);
+    return 0;
+  }
+  if ((strlen(nick) + strlen(reason) + 2) < 1024)
+    sprintf(s, "%s %s", nick, reason);
+  add_seen(SEEN_KICK, victim, m->userhost, chan, s, now,
+  	   get_spent(victim, chan));
+  return 0;
+}
+
+static int gseen_nick(char *nick, char *uhost, char *hand, char *chan,
+		       char *newnick)
+{
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  if (secretchan(chan))
+    chan = buf;
+  add_seen(SEEN_NICK, nick, uhost, chan, newnick, now, get_spent(nick, chan));
+  if (!(use_handles && (hand[0] != '*')))
+    add_seen(SEEN_NCKF, newnick, uhost, chan, nick, now, get_spent(nick, chan));
+  report_seenreq(chan, newnick);
+  if ((hand[0] != '*') && strcasecmp(newnick, hand))
+    report_seenreq(chan, hand);
+  return 0;
+}
+
+#if EGG_IS_MIN_VER(10502)
+static int gseen_part(char *nick, char *uhost, char *hand, char *chan,
+		       char *reason)
+{
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  if (secretchan(chan))
+    chan = buf;
+  add_seen(SEEN_PART, nick, uhost, chan, reason, now, get_spent(nick, chan));
+  return 0;
+}
+#else
+static int gseen_part(char *nick, char *uhost, char *hand, char *chan)
+{
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  if (secretchan(chan))
+    chan = buf;
+  add_seen(SEEN_PART, nick, uhost, chan, "", now, get_spent(nick, chan));
+  return 0;
+}
+#endif
+
+static int gseen_sign(char *nick, char *uhost, char *hand, char *chan,
+		       char *reason)
+{
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  if (secretchan(chan))
+    chan = buf;
+  add_seen(SEEN_SIGN, nick, uhost, chan, reason, now, get_spent(nick, chan));
+  return 0;
+}
+
+static int gseen_splt(char *nick, char *uhost, char *hand, char *chan)
+{
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  if (secretchan(chan))
+    chan = buf;
+  add_seen(SEEN_SPLT, nick, uhost, chan, "", now, get_spent(nick, chan));
+  return 0;
+}
+
+static int gseen_rejn(char *nick, char *uhost, char *hand, char *chan)
+{
+  char buf[10] = "[secret]";
+
+  Context;
+  if (nolog(chan))
+    return 0;
+  if (use_handles && (hand[0] != '*'))
+    nick = hand;
+  if (secretchan(chan))
+    chan = buf;
+  add_seen(SEEN_REJN, nick, uhost, chan, "", now, get_spent(nick, chan));
+  return 0;
+}
+
+static int gseen_chjn STDVAR
+{
+  Context;
+  BADARGS(7, 7, " bot hand chan flag idx host");
+  add_seen(SEEN_CHJN, argv[2], argv[6], argv[3], argv[1], now, -1);
+  return 0;
+}
+
+static int gseen_chpt STDVAR
+{
+  Context;
+  BADARGS(5, 5, " bot hand idx chan");
+  add_seen(SEEN_CHPT, argv[2], "unknown", argv[4], argv[1], now, -1);
+  return 0;
+}
+
+static cmd_t seen_kick[] =
+{
+  {"*", "", (Function) gseen_kick, "gseen"},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_nick[] =
+{
+  {"*", "", (Function) gseen_nick, "gseen"},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_join[] =
+{
+  {"*", "", (Function) gseen_join, "gseen"},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_part[] =
+{
+  {"*", "", (Function) gseen_part, "gseen"},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_sign[] =
+{
+  {"*", "", (Function) gseen_sign, "gseen"},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_splt[] =
+{
+  {"*", "", (Function) gseen_splt, "gseen"},
+  {0, 0, 0, 0}
+};
+
+static cmd_t seen_rejn[] =
+{
+  {"*", "", (Function) gseen_rejn, "gseen"},
+  {0, 0, 0, 0}
+};
diff -Nur src/mod/gseen.mod/slang.c src/mod/gseen.mod/slang.c
--- src/mod/gseen.mod/slang.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/slang.c	2002-10-26 13:18:03.000000000 +0200
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+static struct slang_header *slang_find(struct slang_header *, char *);
+
+#include "slang_text.c"
+#include "slang_multitext.c"
+#include "slang_ids.c"
+#ifndef SLANG_NOTYPES
+#include "slang_types.c"
+#endif
+#include "slang_duration.c"
+#ifndef SLANG_NOFACTS
+#include "slang_facts_places.c"
+#include "slang_facts.c"
+#endif
+#include "slang_chanlang.c"
+
+
+struct slang_header {
+  struct slang_header *next;
+  char *lang;
+  char *desc;
+  struct slang_id *ids;
+#ifndef SLANG_NOTYPES
+  struct slang_type *types;
+#endif
+  struct slang_duration *durations;
+};
+
+static void slang_glob_init()
+{
+  glob_slang_cmd_list = NULL;
+}
+
+static int slang_glob_expmem()
+{
+  return slang_commands_list_expmem(glob_slang_cmd_list);
+}
+
+static void slang_glob_free()
+{
+  slang_commands_list_free(glob_slang_cmd_list);
+  glob_slang_cmd_list = NULL;
+}
+
+static struct slang_header *slang_create(struct slang_header *list, char *lang, char *desc)
+{
+  struct slang_header *nslang, *l;
+
+  Assert(lang);
+  debug2("Creating language '%s' starting by %d", lang, (int) list);
+  for (nslang = list; nslang; nslang = nslang->next)
+    if (!strcasecmp(nslang->lang, lang))
+      return list;
+  nslang = nmalloc(sizeof(struct slang_header));
+  nslang->next = NULL;
+  nslang->desc = NULL;
+  nslang->lang = nmalloc(strlen(lang) + 1);
+  strcpy(nslang->lang, lang);
+  nslang->desc = nmalloc(strlen(desc) + 1);
+  strcpy(nslang->desc, desc);
+  nslang->ids = NULL;
+#ifndef SLANG_NOTYPES
+  nslang->types = NULL;
+#endif
+  nslang->durations = NULL;
+  for (l = list; l && l->next; l = l->next);
+  if (l)
+    l->next = nslang;
+  else {
+    Assert(!list);
+    list = nslang;
+  }
+  return list;
+}
+
+static int slang_expmem(struct slang_header *what)
+{
+  int size = 0;
+
+  while (what) {
+    size += sizeof(struct slang_header);
+    size += strlen(what->lang) + 1;
+    size += strlen(what->desc) + 1;
+    size += slang_id_expmem(what->ids);
+#ifndef SLANG_NOTYPES
+    size += slang_type_expmem(what->types);
+#endif
+    size += slang_duration_expmem(what->durations);
+    what = what->next;
+  }
+  return size;
+}
+
+static void slang_free(struct slang_header *what)
+{
+  struct slang_header *next;
+
+  while (what) {
+    next = what->next;
+    slang_id_free(what->ids);
+#ifndef SLANG_NOTYPES
+    slang_type_free(what->types);
+#endif
+    slang_duration_free(what->durations);
+    nfree(what->lang);
+    nfree(what->desc);
+    nfree(what);
+    what = next;
+  }
+}
+
+static int slang_load(struct slang_header *slang, char *filename)
+{
+  FILE *f;
+  char *buffer, *s;
+  char *cmd, *sid, *strtol_ret;
+#ifndef SLANG_NOTYPES
+  char *type;
+#endif
+  int line, id;
+
+  Assert(slang);
+  putlog(LOG_MISC, "*", "Loading language \"%s\" from %s...", slang->lang, filename);
+  f = fopen(filename, "r");
+  if (!f) {
+    putlog(LOG_MISC, "*", "Couldn't open slangfile \"%s\"!", filename);
+    return 0;
+  }
+  buffer = nmalloc(2000);
+  line = 0;
+  while (!feof(f)) {
+    s = buffer;
+    if (fgets(s, 2000, f)) {
+      line++;
+      // at first, kill those stupid line feeds and carriage returns...
+      if (s[strlen(s) - 1] == '\n')
+        s[strlen(s) - 1] = 0;
+      if (s[strlen(s) - 1] == '\r')
+        s[strlen(s) - 1] = 0;
+      if (!s[0])
+        continue;
+      cmd = newsplit(&s);
+
+      if (!strcasecmp(cmd, "T")) {
+#ifndef SLANG_NOTYPES
+        type = newsplit(&s);
+        slang->types = slang_type_add(slang->types, type, s);
+#endif
+      } else if (!strcasecmp(cmd, "D")) {
+        sid = newsplit(&s);
+        id = strtol(sid, &strtol_ret, 10);
+        if (strtol_ret == sid) {
+          putlog(LOG_MISC, "*", "ERROR in slangfile \"%s\", line %d: %s is not a valid "
+                 "duration index!", filename, line, sid);
+          continue;
+        }
+        slang->durations = slang_duration_add(slang->durations, id, s);
+      } else {
+        id = strtol(cmd, &strtol_ret, 10);
+        if (strtol_ret == cmd)
+          continue;
+        slang->ids = slang_id_add(slang->ids, id, s);
+      }
+    }
+  }
+  fclose(f);
+  nfree(buffer);
+  return 1;
+}
+
+static struct slang_header *slang_find(struct slang_header *where, char *language)
+{
+  struct slang_header *slang = NULL;
+
+  // at first, search for the specified language
+  for (slang = where; slang; slang = slang->next)
+    if (!strcasecmp(slang->lang, language))
+      return slang;
+  // oops... language seems to be invalid. Let's find the default.
+  Assert(default_slang);
+  for (slang = where; slang; slang = slang->next)
+    if (!strcasecmp(slang->lang, default_slang))
+      return slang;
+  // default_slang wasn't found either? *sigh*
+  // Let's return the first known language then.
+  return where;
+}
+
+#ifndef SLANG_NOVALIDATE
+/* slang_valid():
+ * check if the given language is a valid one
+ */
+static int slang_valid(struct slang_header *where, char *language)
+{
+  struct slang_header *slang = NULL;
+
+  for (slang = where; slang; slang = slang->next)
+    if (!strcasecmp(slang->lang, language))
+      return 1;
+  return 0;
+}
+#endif
+
+static char getslang_error[12];
+static char *getslang(int id)
+{
+  char *text;
+
+  if (!glob_slang) {
+    putlog(LOG_MISC, "*", "WARNING! No language selected! (getslang())");
+    return "NOLANG";
+  }
+  text = slang_id_get(glob_slang->ids, id);
+  if (!text) {
+    snprintf(getslang_error, sizeof(getslang_error), "SLANG%d", id);
+    return getslang_error;
+  }
+  return text;
+}
+
+static char *getdur(int idx)
+{
+  char *text;
+
+  Assert((idx >= 0) && (idx < DURATIONS));
+  if (!glob_slang) {
+    putlog(LOG_MISC, "*", "WARNING! No language selected! (getdur())");
+    return "NOLANG";
+  }
+  text = slang_duration_get(glob_slang->durations, idx);
+  if (!text) {
+    snprintf(getslang_error, sizeof(getslang_error), "DUR%d", idx);
+    return getslang_error;
+  }
+  return text;
+}
+
+#ifndef SLANG_NOTYPES
+static char *getslangtype(char *type)
+{
+  char *stype;
+
+  if (!glob_slang) {
+    putlog(LOG_MISC, "*", "WARNING! No language selected! (getslangtype())");
+    return "NOLANG";
+  }
+  stype = slang_type_get(glob_slang->types, type);
+  if (stype)
+    return stype;
+  else
+    return type;
+}
+
+static int slangtypetoi(char *slangtype)
+{
+  char *type;
+
+  if (!glob_slang) {
+    putlog(LOG_MISC, "*", "WARNING! No language selected! (slangtypetoi())");
+    return T_ERROR;
+  }
+  type = slang_type_slang2type(glob_slang->types, slangtype);
+  if (type) {
+    debug1("type: %s", type);
+    return typetoi(type);
+  } else
+    return typetoi(slangtype);
+}
+#endif
+
+#ifndef SLANG_NOGETALL
+static char *getslang_first(int id)
+{
+  char *text;
+
+  if (!glob_slang) {
+    putlog(LOG_MISC, "*", "WARNING! No language selected! (getslang())");
+    return "NOLANG";
+  }
+  text = slang_id_get_first(glob_slang->ids, id);
+  if (!text) {
+    snprintf(getslang_error, sizeof(getslang_error), "SLANG%d", id);
+    return getslang_error;
+  }
+  return text;
+}
+
+static char *getslang_next()
+{
+  return slang_id_get_next();
+}
+#endif
diff -Nur src/mod/gseen.mod/slang_chanlang.c src/mod/gseen.mod/slang_chanlang.c
--- src/mod/gseen.mod/slang_chanlang.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/slang_chanlang.c	2002-10-26 13:18:02.000000000 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+struct slang_chanlang {
+  struct slang_chanlang *next;
+  char *chan;
+  char *lang;
+};
+
+static struct slang_chanlang *chanlangs = NULL;
+
+static struct slang_chanlang *slang_chanlang_add(struct slang_chanlang *, char *, char *);
+static int slang_chanlang_expmem(struct slang_chanlang *);
+static void slang_chanlang_free(struct slang_chanlang *);
+static char *slang_chanlang_get(struct slang_chanlang *, char *);
+
+static struct slang_chanlang *slang_chanlang_add(struct slang_chanlang *where, char *chan, char *lang)
+{
+  struct slang_chanlang *item;
+
+  for (item = where; item; item = item->next)
+    if (!rfc_casecmp(item->chan, chan))
+      break;
+  if (!item) {
+    item = nmalloc(sizeof(struct slang_chanlang));
+    item->chan = nmalloc(strlen(chan) + 1);
+    strcpy(item->chan, chan);
+    item->lang = nmalloc(strlen(lang) + 1);
+    strcpy(item->lang, lang);
+    item->next = where;
+    where = item;
+  } else {
+    Assert(item->lang);
+    item->lang = nrealloc(item->lang, strlen(lang) + 1);
+    strcpy(item->lang, lang);
+  }
+  return where;
+}
+
+static int slang_chanlang_expmem(struct slang_chanlang *what)
+{
+  int size = 0;
+
+  while (what) {
+    Assert(what);
+    Assert(what->chan);
+    Assert(what->lang);
+    size += sizeof(struct slang_chanlang);
+    size += strlen(what->chan) + 1;
+    size += strlen(what->lang) + 1;
+    what = what->next;
+  }
+  return size;
+}
+
+static void slang_chanlang_free(struct slang_chanlang *what)
+{
+  struct slang_chanlang *next;
+
+  while (what) {
+    Assert(what);
+    Assert(what->chan);
+    Assert(what->lang);
+    next = what->next;
+    nfree(what->chan);
+    nfree(what->lang);
+    nfree(what);
+    what = next;
+  }
+}
+
+static char *slang_chanlang_get(struct slang_chanlang *where, char *chan)
+{
+  while (where) {
+    if (!rfc_casecmp(where->chan, chan))
+      return where->lang;
+    where = where->next;
+  }
+  return default_slang;
+}
+
+/* slang_getbynick():
+ * tries to find an appropriate language for nick by searching
+ * him on a channel and using the language of this channel.
+ */
+static struct slang_header *slang_getbynick(struct slang_header *where, char *nick)
+{
+  struct chanset_t *chan;
+
+  for (chan = chanset; chan; chan = chan->next)
+    if (ismember(chan, nick))
+#if EGG_IS_MIN_VER(10500)
+      return slang_find(where, slang_chanlang_get(chanlangs, chan->dname));
+#else
+      return slang_find(where, slang_chanlang_get(chanlangs, chan->name));
+#endif
+  return slang_find(where, default_slang);
+}
diff -Nur src/mod/gseen.mod/slang_duration.c src/mod/gseen.mod/slang_duration.c
--- src/mod/gseen.mod/slang_duration.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/slang_duration.c	2002-10-26 13:18:01.000000000 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#define DURATIONS 13
+
+struct slang_duration {
+  char *durs[DURATIONS];
+};
+
+static struct slang_duration *slang_duration_add(struct slang_duration *where, int idx, char *text)
+{
+  int i;
+
+  if ((idx < 0) || (idx >= DURATIONS)) {
+    putlog(LOG_MISC, "*", "Warning: Invalid duration index \"%d\".", idx);
+    return where;
+  }
+  debug2("Adding duration[%d]: %s", idx, text);
+  if (!where) {
+    where = nmalloc(sizeof(struct slang_duration));
+    for (i = 0; i < DURATIONS; i++)
+      where->durs[i] = NULL;
+  }
+  if (where->durs[idx])
+    nfree(where->durs[idx]);
+  where->durs[idx] = nmalloc(strlen(text) + 1);
+  strcpy(where->durs[idx], text);
+  return where;
+}
+
+static int slang_duration_expmem(struct slang_duration *what)
+{
+  int i, size = 0;
+
+  if (!what)
+    return 0;
+  size += sizeof(struct slang_duration);
+  for (i = 0; i < DURATIONS; i++)
+    if (what->durs[i])
+      size += strlen(what->durs[i]) + 1;
+  return size;
+}
+
+static void slang_duration_free(struct slang_duration *what)
+{
+  int i;
+
+  if (what) {
+    for (i = 0; i < DURATIONS; i++)
+      if (what->durs[i])
+        nfree(what->durs[i]);
+    nfree(what);
+  }
+}
+
+static char *slang_duration_get(struct slang_duration *where, int idx)
+{
+  if (!where) {
+    debug0("no where");
+    return NULL;
+  }
+  if ((idx < 0) || (idx >= DURATIONS)) {
+    debug1("invalid duration index: %d", idx);
+    return NULL;
+  }
+  return where->durs[idx];
+}
diff -Nur src/mod/gseen.mod/slang_gseen_commands.c src/mod/gseen.mod/slang_gseen_commands.c
--- src/mod/gseen.mod/slang_gseen_commands.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/slang_gseen_commands.c	2002-10-26 13:18:06.000000000 +0200
@@ -0,0 +1,235 @@
+static void slang_send_botnick()
+{
+  strncat(slang_text_buf, botname, sizeof(slang_text_buf));
+}
+
+static void slang_send_query()
+{
+  if (glob_query)
+    strncat(slang_text_buf, glob_query, sizeof(slang_text_buf));
+}
+
+static void slang_send_laston()
+{
+  if (glob_laston)
+    strncat(slang_text_buf, glob_laston, sizeof(slang_text_buf));
+}
+
+static void slang_send_otherchan()
+{
+  if (glob_otherchan)
+    strncat(slang_text_buf, glob_otherchan, sizeof(slang_text_buf));
+}
+
+static void slang_send_othernick()
+{
+  if (glob_othernick)
+    strncat(slang_text_buf, glob_othernick, sizeof(slang_text_buf));
+}
+
+static void slang_send_remotebot()
+{
+  if (glob_remotebot)
+    strncat(slang_text_buf, glob_remotebot, sizeof(slang_text_buf));
+}
+
+static void slang_send_snick()
+{
+  if (glob_seendat)
+    strncat(slang_text_buf, glob_seendat->nick, sizeof(slang_text_buf));
+}
+
+static void slang_send_shost()
+{
+  if (glob_seendat)
+    strncat(slang_text_buf, glob_seendat->host, sizeof(slang_text_buf));
+}
+
+static void slang_send_schan()
+{
+  if (glob_seendat)
+    strncat(slang_text_buf, glob_seendat->chan, sizeof(slang_text_buf));
+}
+
+static void slang_send_swhen()
+{
+  char *dur;
+
+  if (glob_seendat) {
+    dur = gseen_duration(now - glob_seendat->when);
+    strncat(slang_text_buf, dur, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_stime()
+{
+  time_t tt;
+  char t[20];
+  
+  if (glob_seendat) {
+    tt = glob_seendat->when;
+    strftime(t, 19, "%d.%m. %H:%M", localtime(&tt));
+    strncat(slang_text_buf, t, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_spent()
+{
+  char *dur;
+
+  if (glob_seendat) {
+    dur = gseen_duration(glob_seendat->spent);
+    strncat(slang_text_buf, dur, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_smsg()
+{
+  if (glob_seendat)
+    strncat(slang_text_buf, glob_seendat->msg, sizeof(slang_text_buf));
+}
+
+static void slang_send_numresults()
+{
+  char buf[7];
+  
+  snprintf(buf, sizeof(buf), "%d", numresults);
+  strncat(slang_text_buf, buf, sizeof(slang_text_buf));
+}
+
+static void slang_send_punisher()
+{
+  char *reason;
+  int len;
+  
+  if (glob_seendat) {
+    reason = strchr(glob_seendat->msg, ' ');
+    if (!reason)
+      strncat(slang_text_buf, glob_seendat->msg, sizeof(slang_text_buf));
+    else {
+      len = (int) reason - (int) glob_seendat->msg;
+      strncat(slang_text_buf, glob_seendat->msg, (sizeof(slang_text_buf) < len) ? sizeof(slang_text_buf) : len);
+    }
+  }
+}
+
+static void slang_send_kickreason()
+{
+  char *reason;
+  
+  if (glob_seendat) {
+    reason = strchr(glob_seendat->msg, ' ');
+    if (reason)
+      strncat(slang_text_buf, reason, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_rnick()
+{
+  if (glob_seenrequest) {
+    Assert(glob_seenrequest->by);
+    Assert(glob_seenrequest->by->who);
+    strncat(slang_text_buf, glob_seenrequest->by->who, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_rchan()
+{
+  if (glob_seenrequest) {
+    Assert(glob_seenrequest->by);
+    Assert(glob_seenrequest->by->chan);
+    strncat(slang_text_buf, glob_seenrequest->by->chan, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_rhost()
+{
+  if (glob_seenrequest) {
+    Assert(glob_seenrequest->by);
+    Assert(glob_seenrequest->by->host);
+    strncat(slang_text_buf, glob_seenrequest->by->host, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_rtime()
+{
+  time_t tt;
+  char t[20];
+  
+  if (glob_seenrequest) {
+    Assert(glob_seenrequest->by);
+    tt = glob_seenrequest->by->when;
+    strftime(t, sizeof(t), "%d.%m. %H:%M", localtime(&tt));
+    strncat(slang_text_buf, t, sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_rwhen()
+{
+  if (glob_seenrequest) {
+    Assert(glob_seenrequest->by);
+    strncat(slang_text_buf, gseen_duration(now - glob_seenrequest->by->when), sizeof(slang_text_buf));
+  }
+}
+
+static void slang_send_requests()
+{
+  char buf[7];
+  
+  snprintf(buf, sizeof(buf), "%d", glob_seenrequests);
+  strncat(slang_text_buf, buf, sizeof(slang_text_buf));
+}
+
+static void slang_send_totalnicks()
+{
+  char buf[7];
+  
+  snprintf(buf, sizeof(buf), "%d", glob_totalnicks);
+  strncat(slang_text_buf, buf, sizeof(slang_text_buf));
+}
+
+static void slang_send_totalbytes()
+{
+  char buf[20];
+  
+  snprintf(buf, sizeof(buf), "%d", glob_totalbytes);
+  strncat(slang_text_buf, buf, sizeof(slang_text_buf));
+}
+
+static void slang_send_nick()
+{
+  if (glob_nick)
+    strncat(slang_text_buf, glob_nick, sizeof(slang_text_buf));
+}
+
+struct slang_text_commands slang_text_gseen_command_table[] =
+{
+  {"botnick", slang_send_botnick},
+  {"query", slang_send_query},
+  {"laston", slang_send_laston},
+  {"otherchan", slang_send_otherchan},
+  {"othernick", slang_send_othernick},
+  {"remotebot", slang_send_remotebot},
+  {"snick", slang_send_snick},
+  {"swhen", slang_send_swhen},
+  {"stime", slang_send_stime},
+  {"shost", slang_send_shost},
+  {"schan", slang_send_schan},
+  {"spent", slang_send_spent},
+  {"smsg", slang_send_smsg},
+  {"numresults", slang_send_numresults},
+  {"snick2", slang_send_smsg},
+  {"bnbot", slang_send_smsg},
+  {"punisher", slang_send_punisher},
+  {"kickreason", slang_send_kickreason},
+  {"rnick", slang_send_rnick},
+  {"rchan", slang_send_rchan},
+  {"rhost", slang_send_rhost},
+  {"rtime", slang_send_rtime},
+  {"rwhen", slang_send_rwhen},
+  {"requests", slang_send_requests},
+  {"totalnicks", slang_send_totalnicks},
+  {"totalbytes", slang_send_totalbytes},
+  {"nick", slang_send_nick},
+  {0, 0}
+};
diff -Nur src/mod/gseen.mod/slang_ids.c src/mod/gseen.mod/slang_ids.c
--- src/mod/gseen.mod/slang_ids.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/slang_ids.c	2002-10-26 13:18:04.000000000 +0200
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+struct slang_id {
+  struct slang_id *next;
+  int id;
+  struct slang_multitext *mtext;
+};
+
+static struct slang_id* slang_id_add(struct slang_id *, int, char *);
+static int slang_id_expmem(struct slang_id *);
+static void slang_id_free(struct slang_id *);
+static char *slang_id_get(struct slang_id *, int);
+
+static struct slang_id* slang_id_add(struct slang_id *where, int id, char *text)
+{
+  struct slang_id *newitem;
+
+  newitem = NULL;
+  if (where) {
+    for (newitem = where; newitem; newitem = newitem->next)
+      if (newitem->id == id)
+        break;
+  }
+  if (!newitem) {
+    newitem = nmalloc(sizeof(struct slang_id));
+    newitem->next = NULL;
+    newitem->id = id;
+    newitem->mtext = NULL;
+    if (where)
+      newitem->next = where;
+    else
+      newitem->next = NULL;
+    where = newitem;
+  }
+  newitem->mtext = slang_mtext_add(newitem->mtext, text);
+  return where;
+}
+
+static int slang_id_expmem(struct slang_id *what)
+{
+  int size = 0;
+
+  for (; what; what = what->next) {
+    size += sizeof(struct slang_id);
+    size += slang_multitext_expmem(what->mtext);
+  }
+  return size;
+}
+
+static void slang_id_free(struct slang_id *what)
+{
+  struct slang_id *next;
+
+  while (what) {
+    next = what->next;
+    slang_multitext_free(what->mtext);
+    nfree(what);
+    what = next;
+  }
+}
+
+static char *slang_id_get(struct slang_id *where, int i)
+{
+  while (where) {
+    if (where->id == i)
+      return slang_multitext_getrandomtext(where->mtext);
+    where = where->next;
+  }
+  return NULL;
+}
+
+#ifndef SLANG_NOGETALL
+static char *slang_id_get_first(struct slang_id *where, int id)
+{
+  while (where) {
+    if (where->id == id) {
+      return slang_multitext_get_first(where->mtext);
+    }
+    where = where->next;
+  }
+  return NULL;
+}
+
+static char *slang_id_get_next()
+{
+  return slang_multitext_get_next();
+}
+#endif
diff -Nur src/mod/gseen.mod/slang_multitext.c src/mod/gseen.mod/slang_multitext.c
--- src/mod/gseen.mod/slang_multitext.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/slang_multitext.c	2002-10-26 13:18:05.000000000 +0200
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+struct slang_mt_content {
+  struct slang_mt_content *next;
+  struct slang_text *text;
+};
+
+struct slang_multitext {
+  int nr;
+  struct slang_mt_content *contents;
+};
+
+static struct slang_multitext *slang_mtext_add(struct slang_multitext *, char *);
+static int slang_multitext_expmem(struct slang_multitext *);
+static void slang_multitext_free(struct slang_multitext *);
+static char *slang_multitext_getrandomtext(struct slang_multitext *);
+#ifndef SLANG_NOTYPES
+static struct slang_text *slang_multitext_find(struct slang_multitext *, char *);
+#endif
+#ifndef SLANG_NOGETALL
+static char *slang_multitext_get_first(struct slang_multitext *);
+static char *slang_multitext_get_next();
+#endif
+
+static struct slang_multitext *slang_mtext_add(struct slang_multitext *where, char *text)
+{
+  struct slang_mt_content *oc, *nc;
+
+  if (!where) {
+    where = nmalloc(sizeof(struct slang_multitext));
+    where->nr = 0;
+    where->contents = NULL;
+  }
+  nc = nmalloc(sizeof(struct slang_mt_content));
+  nc->next = NULL;
+  nc->text = slang_text_parse(text);
+  for (oc = where->contents; oc && oc->next; oc = oc->next);
+  if (oc) {
+    Assert(!oc->next);
+    oc->next = nc;
+  } else
+    where->contents = nc;
+  where->nr++;
+  return where;
+}
+
+static int slang_multitext_expmem(struct slang_multitext *what)
+{
+  struct slang_mt_content *content;
+  int size = 0;
+
+  if (!what) {
+    debug0("WARNING! slang_multitext_expmem() called with NULL pointer!");
+    return 0;
+  }
+  size += sizeof(struct slang_multitext);
+  for (content = what->contents; content; content = content->next) {
+    size += sizeof(struct slang_mt_content);
+    size += slang_text_expmem(content->text);
+  }
+  return size;
+}
+
+static void slang_multitext_free(struct slang_multitext *what)
+{
+  struct slang_mt_content *content, *next;
+
+  if (!what) {
+    debug0("WARNING! slang_multitext_free() called with NULL pointer!");
+    return;
+  }
+  content = what->contents;
+  while (content) {
+    next = content->next;
+    slang_text_free(content->text);
+    nfree(content);
+    content = next;
+  }
+  nfree(what);
+}
+
+static char *slang_multitext_getrandomtext(struct slang_multitext *where)
+{
+  struct slang_mt_content *content;
+  unsigned long x;
+
+  if (!where)
+    return NULL;
+  x = random() % where->nr;
+  for (content = where->contents; content; content = content->next)
+    if (!x)
+      return slang_text_get(content->text);
+    else
+      x--;
+  // we should never reach this part
+  debug0("warning: getrandomtext didn't find anything!");
+  return NULL;
+}
+
+#ifndef SLANG_NOTYPES
+static struct slang_text *slang_multitext_find(struct slang_multitext *where, char *what)
+{
+  struct slang_mt_content *content;
+
+  Assert(where);
+  for (content = where->contents; content; content = content->next) {
+    Assert(content->text);
+    if (!slang_text_strcasecmp(content->text, what))
+      return content->text;
+  }
+  return NULL;
+}
+#endif
+
+#ifndef SLANG_NOGETALL
+static struct slang_mt_content *glob_mtext_content;
+static char *slang_multitext_get_first(struct slang_multitext *where)
+{
+  Assert(where);
+  glob_mtext_content = where->contents;
+  if (glob_mtext_content)
+    return slang_text_get(glob_mtext_content->text);
+  else
+    return NULL;
+}
+
+static char *slang_multitext_get_next()
+{
+  glob_mtext_content = glob_mtext_content->next;
+  if (glob_mtext_content)
+    return slang_text_get(glob_mtext_content->text);
+  else
+    return NULL;
+}
+#endif
diff -Nur src/mod/gseen.mod/slang_text.c src/mod/gseen.mod/slang_text.c
--- src/mod/gseen.mod/slang_text.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/slang_text.c	2002-10-26 13:18:07.000000000 +0200
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+struct slang_text {
+  struct slang_text *next;
+  char *string;
+  void (*command) ();
+};
+
+struct slang_text_commands {
+  char *command;
+  void (*targetfunc) ();
+};
+
+struct slang_command_list {
+  struct slang_command_list *next;
+  struct slang_text_commands *commands;
+};
+
+static struct slang_text *slang_text_parse(char *);
+static struct slang_text *slang_text_create(struct slang_text *);
+static void slang_text_add_string(struct slang_text *, char *);
+static void slang_text_add_command(struct slang_text *, char *);
+static void slang_text_free(struct slang_text *);
+static int slang_text_expmem(struct slang_text *);
+static char *slang_text_get(struct slang_text *);
+#ifndef SLANG_NOTYPES
+static int slang_text_strcasecmp(struct slang_text *, char *);
+#endif
+
+static struct slang_text *slang_text_parse(char *text)
+{
+  char *cmdstart, *cmdend;
+  struct slang_text *firstitem, *item;
+
+  firstitem = slang_text_create(NULL);
+  item = firstitem;
+  while ((cmdstart = strstr(text, "<?"))) {
+    cmdstart[0] = 0;
+    slang_text_add_string(item, text);
+    item = slang_text_create(item);
+    text += 2;
+    cmdstart += 2;
+    cmdend = strstr(cmdstart, "/?>");
+    if (!cmdend) {
+      putlog(LOG_MISC, "*", "ERROR parsing slang text: unterminated command \"%s\"!", cmdstart);
+      break;
+    }
+    cmdend[0] = 0;
+    slang_text_add_command(item, cmdstart);
+    item = slang_text_create(item);
+    text = cmdend + 3;
+  }
+  slang_text_add_string(item, text);
+  return firstitem;
+}
+
+static struct slang_text *slang_text_create(struct slang_text *where)
+{
+  struct slang_text *newpart;
+
+  newpart = nmalloc(sizeof(struct slang_text));
+  newpart->next = NULL;
+  newpart->string = NULL;
+  newpart->command = NULL;
+  while (where && where->next)
+    where = where->next;
+  if (where)
+    where->next = newpart;
+  return newpart;
+}
+
+static void slang_text_add_string(struct slang_text *item, char *s)
+{
+  Assert(item);
+  Assert(!item->string);
+  item->string = nmalloc(strlen(s) + 1);
+  strcpy(item->string, s);
+}
+
+static void slang_text_free(struct slang_text *item)
+{
+  if (!item)
+    return;
+  slang_text_free(item->next);
+  if (item->string)
+    nfree(item->string);
+  nfree(item);
+}
+
+static int slang_text_expmem(struct slang_text *item)
+{
+  int size = 0;
+
+  while (item) {
+    size += sizeof(struct slang_text);
+    if (item->string)
+      size += strlen(item->string) + 1;
+    item = item->next;
+  }
+  return size;
+}
+
+#ifndef SLANG_NOTYPES
+static int slang_text_strcasecmp(struct slang_text *item, char *text)
+{
+  Assert(item);
+  debug2("s_t_sc: '%s', '%s'", text, item->string);
+  if (item->command || item->next)
+    return 1;
+  return strcasecmp(item->string, text);
+}
+#endif
+
+static char slang_text_buf[500];
+static char *slang_text_get(struct slang_text *item)
+{
+  slang_text_buf[0] = 0;
+  while (item) {
+    if (item->string)
+      strncat(slang_text_buf, item->string, sizeof(slang_text_buf));
+    else if (item->command)
+      item->command();
+    item = item->next;
+  }
+  return slang_text_buf;
+}
+
+/*****************************************************/
+
+
+static struct slang_command_list *glob_slang_cmd_list;
+
+static struct slang_command_list *slang_commands_list_add(struct slang_command_list *where, struct slang_text_commands *what)
+{
+  struct slang_command_list *newcommandlist;
+
+  newcommandlist = nmalloc(sizeof(struct slang_command_list));
+  newcommandlist->commands = what;
+  newcommandlist->next = where;
+  return newcommandlist;
+}
+
+static int slang_commands_list_expmem(struct slang_command_list *what)
+{
+  int size = 0;
+
+  while (what) {
+    size += sizeof(struct slang_command_list);
+    what = what->next;
+  }
+  return size;
+}
+
+static void slang_commands_list_free(struct slang_command_list *what)
+{
+  struct slang_command_list *next;
+
+  while (what) {
+    next = what->next;
+    nfree(what);
+    what = next;
+  }
+}
+
+static void slang_text_add_command(struct slang_text *item, char *s)
+{
+  struct slang_command_list *cmdlist;
+  char *cmd;
+  int i;
+
+  cmd = newsplit(&s);
+  i = 0;
+  for (cmdlist = glob_slang_cmd_list; cmdlist; cmdlist = cmdlist->next) {
+    for (i = 0; 1; i++) {
+      if (!cmdlist->commands[i].command)
+        break;
+      if (!strcasecmp(cmdlist->commands[i].command, cmd)) {
+        item->command = cmdlist->commands[i].targetfunc;
+        return;
+      }
+    }
+  }
+  putlog(LOG_MISC, "*", "ERROR! Unknown slang-command: '%s'", cmd);
+}
diff -Nur src/mod/gseen.mod/tclcmds.c src/mod/gseen.mod/tclcmds.c
--- src/mod/gseen.mod/tclcmds.c	1970-01-01 01:00:00.000000000 +0100
+++ src/mod/gseen.mod/tclcmds.c	2002-10-26 13:18:08.000000000 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2000,2001  Florian Sander
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+static int tcl_setchanseenlang STDVAR
+{
+  Context;
+  BADARGS(3, 3, " channel language");
+  chanlangs = slang_chanlang_add(chanlangs, argv[1], argv[2]);
+  return TCL_OK;
+}
+
+static int tcl_loadseenslang STDVAR
+{
+//  int ret = 0;
+  char *shortname, *longname, *filename;
+  struct slang_header *slang;
+
+  Context;
+  BADARGS(4, 4, " language description langfile");
+  shortname = argv[1];
+  longname = argv[2];
+  filename = argv[3];
+  coreslangs = slang_create(coreslangs, shortname, longname);
+  slang = slang_find(coreslangs, shortname);
+  Assert(slang);
+  if (!slang_load(slang, filename)) {
+    Tcl_AppendResult(irp, "Couldn't open seenslang file!!!", NULL);
+    return TCL_ERROR;
+  }
+  return TCL_OK;
+}
+
+static tcl_cmds gseentcls[] =
+{
+  {"loadseenslang", tcl_loadseenslang},
+  {"setchanseenlang", tcl_setchanseenlang},
+  {0, 0}
+};