Tkabber plugins

Check-in [3c81c850e7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Reformatted the code, moved data files into subdirectories.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3c81c850e737bd1bb8e20ff26adc62a260e54bc0
User & Date: sgolovan 2015-05-08 17:58:21
Context
2015-05-08
18:08
Adapted the Georoster plugin to the Ttk based interface. check-in: d5b95d5ff3 user: sgolovan tags: trunk
17:58
Reformatted the code, moved data files into subdirectories. check-in: 3c81c850e7 user: sgolovan tags: trunk
15:15
Reformatted the code. check-in: 2a2f870bfb user: sgolovan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1












2
3
4
5
6
7
8
2015-05-08  Sergei Golovan  <sgolovan@nes.ru>













	* floatinglog/ChangeLog, floatinglog/floatinglog.tcl,
	  floatinglog/msgs/de.msg, floatinglog/msgs/es.msg,
	  floatinglog/msgs/pl.msg, floatinglog/msgs/ru.msg: Reformatted the
	  code.

	* floatingcontact/README, floatingcontact/floatingcontact.tcl,

>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2015-05-08  Sergei Golovan  <sgolovan@nes.ru>

	* georoster/ChangeLog, georoster/cities/earth,
	  georoster/cities/earth.ru, georoster/coords/de.coords,
	  georoster/coords/jm.coords, georoster/coords/nl.coords,
	  georoster/coords/ru.coords, georoster/coords/ua.coords,
	  georoster/coords/us.coords, georoster/georoster.tcl,
	  georoster/maps/bwmap2.gif, georoster/maps/bwmap4.gif,
	  georoster/maps/colormap.jpg, georoster/maps/darkmap.gif,
	  georoster/msgs/de.msg, georoster/msgs/es.msg, georoster/msgs/nl.msg,
	  georoster/msgs/pl.msg, georoster/msgs/ro.msg, georoster/msgs/ru.msg,
	  georoster/msgs/uk.msg: Reformatted the code, moved data files into
	  subdirectories.

	* floatinglog/ChangeLog, floatinglog/floatinglog.tcl,
	  floatinglog/msgs/de.msg, floatinglog/msgs/es.msg,
	  floatinglog/msgs/pl.msg, floatinglog/msgs/ru.msg: Reformatted the
	  code.

	* floatingcontact/README, floatingcontact/floatingcontact.tcl,

Changes to georoster/ChangeLog.

157
158
159
160
161
162
163
164
	coordinates (LAT/LON fields or REGION/LOCALITY and/or PCODE for
	US) (thanks to Marshall T. Rose)

	* earth.ru: Added russian translation

	* earth: Removed overlapped cities, added some new cities (thanks
	to Roger Sondermann)








<
157
158
159
160
161
162
163

	coordinates (LAT/LON fields or REGION/LOCALITY and/or PCODE for
	US) (thanks to Marshall T. Rose)

	* earth.ru: Added russian translation

	* earth: Removed overlapped cities, added some new cities (thanks
	to Roger Sondermann)

Name change from georoster/earth to georoster/cities/earth.

1
2
3
4
5
6
7
8
..
94
95
96
97
98
99
100
101

# Longitudes and latitudes are available from:
# http://www.heavens-above.com/countries.asp
# http://www.getty.edu/research/tools/vocabulary/tgn/index.html

   90.00    0.00 "North Pole"                                          # North Pole
  -90.00    0.00 "South Pole"                                          # South Pole

................................................................................
   49.27 -123.12 "Vancouver"            timezone=America/Vancouver     # Canada
   43.15  131.88 "Vladivostok"          timezone=Asia/Vladivostok      # Russia
   38.88  -77.03 "Washington"           timezone=US/Eastern            # USA
#  30.58  114.32 "Wuhan"                timezone=Asia/Shanghai         # China
#  34.27  108.90 "Xian"                 timezone=Asia/Shanghai         # China
   56.87   60.58 "Yekaterinburg"        timezone=Asia/Yekaterinburg    # Russia
#  35.47  139.63 "Yokohama"             timezone=Asia/Tokyo            # Japan

<







 







<

1
2
3
4
5
6
7
..
93
94
95
96
97
98
99


# Longitudes and latitudes are available from:
# http://www.heavens-above.com/countries.asp
# http://www.getty.edu/research/tools/vocabulary/tgn/index.html

   90.00    0.00 "North Pole"                                          # North Pole
  -90.00    0.00 "South Pole"                                          # South Pole

................................................................................
   49.27 -123.12 "Vancouver"            timezone=America/Vancouver     # Canada
   43.15  131.88 "Vladivostok"          timezone=Asia/Vladivostok      # Russia
   38.88  -77.03 "Washington"           timezone=US/Eastern            # USA
#  30.58  114.32 "Wuhan"                timezone=Asia/Shanghai         # China
#  34.27  108.90 "Xian"                 timezone=Asia/Shanghai         # China
   56.87   60.58 "Yekaterinburg"        timezone=Asia/Yekaterinburg    # Russia
#  35.47  139.63 "Yokohama"             timezone=Asia/Tokyo            # Japan

Name change from georoster/earth.ru to georoster/cities/earth.ru.

1
2
3
4
5
6
7
8
..
89
90
91
92
93
94
95
96

# Longitudes and latitudes are from
# http://www.getty.edu/research/tools/vocabulary/tgn/index.html
# http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_431.html

   90.00    0.00 "Северный полюс"       color=LightBlue                # North Pole
  -90.00    0.00 "Южный полюс"          color=LightBlue                # South Pole

................................................................................
#  35.13  136.88 "Нагоя"                timezone=Asia/Tokyo            # Japan
#  35.08  129.03 "Пусан"                timezone=Asia/Seoul            # South Korea
#  39.00  125.78 "Пхеньян"              timezone=Asia/Pyongyang        # North Korea
#  41.83  123.43 "Шеньян"               timezone=Asia/Shanghai         # China
#  30.58  114.32 "Ухань"                timezone=Asia/Shanghai         # China
#  34.27  108.90 "Сиань"                timezone=Asia/Shanghai         # China
#  35.47  139.63 "Йокогама"             timezone=Asia/Tokyo            # Japan

<







 







<

1
2
3
4
5
6
7
..
88
89
90
91
92
93
94


# Longitudes and latitudes are from
# http://www.getty.edu/research/tools/vocabulary/tgn/index.html
# http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_431.html

   90.00    0.00 "Северный полюс"       color=LightBlue                # North Pole
  -90.00    0.00 "Южный полюс"          color=LightBlue                # South Pole

................................................................................
#  35.13  136.88 "Нагоя"                timezone=Asia/Tokyo            # Japan
#  35.08  129.03 "Пусан"                timezone=Asia/Seoul            # South Korea
#  39.00  125.78 "Пхеньян"              timezone=Asia/Pyongyang        # North Korea
#  41.83  123.43 "Шеньян"               timezone=Asia/Shanghai         # China
#  30.58  114.32 "Ухань"                timezone=Asia/Shanghai         # China
#  34.27  108.90 "Сиань"                timezone=Asia/Shanghai         # China
#  35.47  139.63 "Йокогама"             timezone=Asia/Tokyo            # Japan

Name change from georoster/de.coords to georoster/coords/de.coords.

1
2
3
4
5
6
7
8
.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
84
85
86
87
88
89
90
91
#
# a coords file has two parts:
#
#    - a section that normalizes region names
#   0: normalized name
#   1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#   0: normalized region name
#   1: locality name
#   2: latitude
#   3: longitude
#
# all fields must be tab-separated
# all strings must are lower-case
#


#
# region normalization
#

#
# locality coordinates
................................................................................
	trier	49.75	6.63
	viersen	51.25	6.38
	weitramsdorf	50.25	10.88
	wetzlar	50.55	8.50
	wiesbaden	50.08	8.25
	winzerhausen	49.02	9.26
	würzburg	49.80	9.95

<







 







<
<







 







<

1
2
3
4
5
6
7
.
8
9
10
11
12
13
14


15
16
17
18
19
20
21
..
81
82
83
84
85
86
87


# a coords file has two parts:
#
#    - a section that normalizes region names
#   0: normalized name
#   1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#   0: normalized region name
#   1: locality name
#   2: latitude
#   3: longitude
#
# all fields must be tab-separated
# all strings must are lower-case



#
# region normalization
#

#
# locality coordinates
................................................................................
	trier	49.75	6.63
	viersen	51.25	6.38
	weitramsdorf	50.25	10.88
	wetzlar	50.55	8.50
	wiesbaden	50.08	8.25
	winzerhausen	49.02	9.26
	würzburg	49.80	9.95

Name change from georoster/jm.coords to georoster/coords/jm.coords.

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
#
# a	coords file	has	two	parts:
#
#	 - a section that normalizes region	names
#	0: normalized name
#	1: any variation
#
#	 - a section that maps a region/locality to	a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality	name
#	2: latitude
#	3: longitude
#
# all fields must be tab-separated
# all strings must are lower-case
#


#
# region normalization
#

#
# locality coordinates
# http://www.heavens-above.com/countries.asp
#
	kingston	18.00	-76.80
<







 







<
<











1
2
3
4
5
6
7
.
8
9
10
11
12
13
14


15
16
17
18
19
20
21
22
23
24

# a	coords file	has	two	parts:
#
#	 - a section that normalizes region	names
#	0: normalized name
#	1: any variation
#
#	 - a section that maps a region/locality to	a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality	name
#	2: latitude
#	3: longitude
#
# all fields must be tab-separated
# all strings must are lower-case



#
# region normalization
#

#
# locality coordinates
# http://www.heavens-above.com/countries.asp
#
	kingston	18.00	-76.80

Name change from georoster/nl.coords to georoster/coords/nl.coords.

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
#
# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case
#


#
# region normalization
#

#
# locality coordinates
#

	eindhoven	51.75	5.62
<







 







<
<








<


1
2
3
4
5
6
7
.
8
9
10
11
12
13
14


15
16
17
18
19
20
21
22

23

# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case



#
# region normalization
#

#
# locality coordinates
#

	eindhoven	51.75	5.62

Name change from georoster/ru.coords to georoster/coords/ru.coords.

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
#
# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case
#


#
# region normalization
#

#
# locality coordinates
#

	moscow	55.75	37.70
<







 







<
<








<


1
2
3
4
5
6
7
.
8
9
10
11
12
13
14


15
16
17
18
19
20
21
22

23

# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case



#
# region normalization
#

#
# locality coordinates
#

	moscow	55.75	37.70

Name change from georoster/ua.coords to georoster/coords/ua.coords.

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
#
# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case
#


#
# region normalization
#

#
# locality coordinates
#

	sevastopol	47.62	33.52
<







 







<
<








<


1
2
3
4
5
6
7
.
8
9
10
11
12
13
14


15
16
17
18
19
20
21
22

23

# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case



#
# region normalization
#

#
# locality coordinates
#

	sevastopol	47.62	33.52

Name change from georoster/us.coords to georoster/coords/us.coords.

1
2
3
4
5
6
7
8
.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case
#


#
# region normalization
#

al	alabama
ak	alaska
................................................................................
ut	utah
vt	vermont
va	virginia
wa	washington
wv	west va
wi	wisconsin
wy	wyoming


#
# locality coordinates
#

al	alexander city	32.95	-85.95
al	anniston	33.58	-85.85
<







 







<
<







 







<








1
2
3
4
5
6
7
.
8
9
10
11
12
13
14


15
16
17
18
19
20
21
..
71
72
73
74
75
76
77

78
79
80
81
82
83
84

# a coords file has two parts:
#
#    - a section that normalizes region names
#	0: normalized name
#	1: any variation
#
#    - a section that maps a region/locality to a lat/lon pair
................................................................................
#	0: normalized region name
#	1: locality name
#	2: latitude
#	3: longitude
#
# all fields must be are tab-separated
# all strings must are lower-case



#
# region normalization
#

al	alabama
ak	alaska
................................................................................
ut	utah
vt	vermont
va	virginia
wa	washington
wv	west va
wi	wisconsin
wy	wyoming


#
# locality coordinates
#

al	alexander city	32.95	-85.95
al	anniston	33.58	-85.85

Changes to georoster/georoster.tcl.

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
...
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
...
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
...
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
...
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
...
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
...
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
...
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
....
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# georoster.tcl --
#
#	This file implements Georoster plugin for the Tkabber XMPP client.

###############################################################################

package require msgcat

###############################################################################

option add *GeoRoster.cityforeground green3 widgetDefault

###############################################################################

namespace eval georoster {
    ::msgcat::mcload [file join [file dirname [info script]] msgs]

    if {![::plugins::is_registered georoster]} {
	::plugins::register georoster \
			    -namespace [namespace current] \
			    -source [info script] \
			    -description [::msgcat::mc "Whether the Georoster plugin is loaded."] \

			    -loadcommand [namespace code load] \
			    -unloadcommand [namespace code unload]
	return
    }

    variable georoster
    variable options

    if {![info exists options(citiesfile)]} {
	set options(citiesfile) [file join [file dirname [info script]] earth]

	foreach pr [::msgcat::mcpreferences] {
	    set f [file join [file dirname [info script]] "earth.$pr"]
	    if {[file exists $f]} {
		set options(citiesfile) $f
		break
	    }
	}
	unset pr f
    }

    if {![info exists options(3166file)]} {
	set options(3166file) [file join [file dirname [info script]] iso3166]
    }
    if {![info exists georoster(3166)]} {
	set georoster(3166) {}
    }

    foreach file [glob -nocomplain \
		       [file join [file dirname [info script]] ??.coords]] {

	set c [file tail [file rootname $file]]
	if {![info exists options(coords,$c)]} {
	    set options(coords,$c) $file
	}
    }

    if {![info exists options(mapfile)]} {
	set options(mapfile) \
	    [file join [file dirname [info script]] bwmap2.gif]

	proc lo {x y} {expr {($x - 649)*18/65 + 10}}
	proc la {x y} {expr {(371 - $y)*9/40}}

	proc x {lo la} {expr {649+(($lo-10)*65/18)}}
	proc y {lo la} {expr {371-($la * 40/9)}}
    }

    custom::defgroup Plugins [::msgcat::mc "Plugins options."] \
	-group Tkabber

    custom::defgroup Georoster [::msgcat::mc "Georoster plugin options."] \
	-group Plugins

    custom::defvar options(automatic) 0 \
	[::msgcat::mc "Automatically open Georoster window."] \
	-group Georoster -type boolean

    custom::defvar options(check_vcard) 0 \
	[::msgcat::mc "Automatically look at vCard to find users coordinates."] \

	-group Georoster -type boolean

    custom::defvar options(show_last_known) 0 \
	[::msgcat::mc "Display users who are no longer available."] \
	-group Georoster -type boolean

    custom::defvar options(default_country) us \
	[::msgcat::mc "Default country to use when looking at a vCard."] \
	-group Georoster -type string

    set opt2label_list [list none    [::msgcat::mc "Don't show cities"] \
			     markers [::msgcat::mc "Show only city markers"] \
			     all     [::msgcat::mc "Show city markers and names"]]

    array set opt2label $opt2label_list

    array set label2opt [list [::msgcat::mc "Don't show cities"]           none \
			      [::msgcat::mc "Show only city markers"]      markers \
			      [::msgcat::mc "Show city markers and names"] all]

    custom::defvar options(showcities) all \
	[::msgcat::mc "Specify how to show cities at the map."] \
	-group Georoster -type options \
	-values $opt2label_list -command [namespace current]::set_showcities

    variable showcities $opt2label($options(showcities))
}

package require http 2
package require xmpp::private

................................................................................
    hook::add finload_hook [namespace current]::setup
    hook::add client_presence_hook [namespace current]::presence_change
    hook::add connected_hook [namespace current]::init 1
    hook::add connected_hook [namespace current]::retrieve
    hook::add save_session_hook [namespace current]::save_session

    trace variable [namespace current]::showcities w \
		   [namespace current]::set_option_showcities
    setup

    foreach xlib [connections] {
	init $xlib
	retrieve $xlib
    }
}

proc georoster::unload {} {
    hook::remove finload_hook [namespace current]::setup
    hook::remove client_presence_hook [namespace current]::presence_change
    hook::remove connected_hook [namespace current]::init 1
    hook::remove connected_hook [namespace current]::retrieve
    hook::remove save_session_hook [namespace current]::save_session

    trace vdelete [namespace current]::showcities w \
		  [namespace current]::set_option_showcities
    catch {
	set m [.mainframe getmenu roster]
	set idx [$m index [::msgcat::mc "Georoster"]]
	$m delete $idx
    }

    destroy_win .georoster

    variable mapimage
    variable georoster
    variable status
................................................................................

    load_cities
    load_3166

    set m [.mainframe getmenu roster]

    $m add command \
	-label [::msgcat::mc "Georoster"] \
	-command [list [namespace current]::open_georoster -raise 1]
}

###############################################################################

proc georoster::open_georoster {args} {
    variable options
    variable mapimage

    set raise 0
    foreach {key val} $args {
	switch -- $key {
	    -raise { set raise $val }
	}
    }

    set w .georoster
    if {[winfo exists $w]} {
	if {$raise} {
	    raise_win $w
	}
	return
    }

    set title [::msgcat::mc "Georoster"]
    add_win $w -title $title \
	       -tabtitle $title \
	       -class GeoRoster \
	       -raise $raise

    set sw [ScrolledWindow $w.sw]
    pack $sw -side top -fill both -expand yes
    set c [canvas $w.c]
    $sw setwidget $c


    DropSite::register $c -droptypes {JID {}} \
	-dropcmd [list [namespace current]::drop_jid $c]

    set tb [frame $w.tb]
    pack $tb -side bottom -fill x

    set status [label $tb.status -textvariable [namespace current]::status]
    pack $status -side left -anchor w

    set store [button $tb.store -text [::msgcat::mc "Store"] \
		   -command [namespace current]::store]
    pack $store -side right

    set cities [OptionMenu $tb.cities \
		    [namespace current]::showcities \
		    [::msgcat::mc "Don't show cities"] \
		    [::msgcat::mc "Show only city markers"] \
		    [::msgcat::mc "Show city markers and names"]]
    pack $tb.cities -side right


    $c create image 0 0 -image $mapimage -anchor nw -tags map
    $w.c configure -scrollregion [$w.c bbox all]

    bind $c <Motion> [list [namespace current]::on_mouse_move $c %x %y]
    bind $c <Leave> [list set [namespace current]::status ""]

    bind $c <ButtonPress-1> \
	[list [namespace current]::move_b1p \
	     [double% $c] %x %y]
    bind $c <B1-Motion> [list [namespace current]::move_b1m \
			     [double% $c] %x %y]
    bind $c <ButtonRelease-1> \
	[list [namespace current]::move_b1r [double% $c]]

    bind $c <<PasteSelection>> \
	[list [namespace current]::delete [double% $c] %x %y]
    bind $c <Control-ButtonPress-1> \
	[list [namespace current]::delete [double% $c] %x %y]

    redraw $c
}

###############################################################################

proc georoster::on_mouse_move {c x y} {
................................................................................
    if {![winfo exists $c]} return

    $c delete icon

    redraw_cities $c

    foreach nxlib [array names georoster jids,*] {
	set xlib [string range $nxlib 5 end]

	foreach jid $georoster(jids,$xlib) {
	    set lo $georoster(lo,$xlib,$jid)
	    set la $georoster(la,$xlib,$jid)
	    set x [x $lo $la]
	    set y [y $lo $la]

	    set icon roster/user/unavailable
	    catch {set icon [ifacetk::roster::get_jid_icon $xlib $jid]}

	    set tag [jid_to_tag $jid]

	    $c create image $x $y -image $icon \
		-tags [list icon xlib$xlib jid$tag] -anchor c

	    set doubledjid [double% $jid]
	    set jids [ifacetk::roster::get_jids_of_user $xlib $jid]

	    if {[llength $jids] > 0} {
		set doubledjids [double% $jids]
	    } else {
		set jids [list $jid]
		# TODO: Turn into metacontacts
		#if {$ifacetk::roster::use_aliases && \
		#        [info exists roster::aliases($jid)]} {
		#    set jids [concat $jids $roster::aliases($jid)]
		#}
		set doubledjids [double% $jids]
	    }

	    #$c bind jid$tag <Any-Enter> \
	    #    +[list eval balloon::set_text \
	    #         \[roster::jids_popup_info [list $doubledjids]\]]
	    #
	    #$c bind jid$tag <Any-Motion> \
	    #    [list eval balloon::on_mouse_move \
	    #        \[roster::jids_popup_info [list $doubledjids]\] %X %Y]

	    $c bind jid$tag <Any-Enter> \
		+[list [namespace current]::set_balloon_text \
		      balloon::set_text \
		      $xlib $doubledjid %X %Y]

	    $c bind jid$tag <Any-Motion> \
		[list [namespace current]::set_balloon_text \
		     balloon::on_mouse_move \
		     $xlib $doubledjid %X %Y]

	    $c bind jid$tag <Any-Leave> {+
		balloon::destroy
	    }
	}
    }
}

###############################################################################

proc georoster::set_balloon_text {op xlib jid sx sy} {
    set c .georoster.c
    set x [$c canvasx [expr {$sx - [winfo rootx $c]}]]
    set y [$c canvasy [expr {$sy - [winfo rooty $c]}]]

    set ids [$c find overlapping \
		 [expr {$x-2}] [expr {$y-2}] \
		 [expr {$x+2}] [expr {$y+2}]]

    set city_prefix ""

    foreach id $ids {
	set tags [$c gettags $id]
	if {[lsearch -exact $tags city] >= 0 && [lsearch -exact $tags oval] >= 0} {

	    set name [string range [lsearch -inline -glob $tags name*] 4 end]
	    append city_prefix "$name\n"
	}
    }

    set all_jids {}

    foreach id $ids {
	set tags [$c gettags $id]

	if {[lsearch -exact $tags icon] < 0} continue

	set xlib [string range [lsearch -inline -glob $tags xlib*] 4 end]

	set jidtag [string range [lsearch -inline -glob $tags jid*] 3 end]
	set jid [tag_to_jid $jidtag]

	set jids {}
	foreach j [ifacetk::roster::get_jids_of_user $xlib $jid] {
	    lappend jids [list $xlib $j]
	}

	if {[llength $jids] == 0} {
	    if {[catch { list [list $xlib $jid] } jids]} {
		set jids {}
	    }
	    # TODO: Turn into metacontacts
	    #if {$ifacetk::roster::use_aliases && [info exists roster::aliases($jid)]} {

	    #	foreach j $roster::aliases($jid) {
	    #	    lappend jids [list $xlib $j]
	    #	}

	    #}
	}
	set all_jids [concat $all_jids $jids]
    }

    set all_jids [lsort -unique $all_jids]

    set text ""
    set i 0
    foreach cj $all_jids {
	lassign $cj xlib j
	append text "\n"
	append text [::msgcat::mc "Connection: %s" [connection_jid $xlib]]
	append text "\n"
	append text [ifacetk::roster::user_popup_info $xlib $j $i]
	incr i
    }
    set text [string trimleft $text "\n"]

    if {$op == "balloon::set_text"} {
	$op "${city_prefix}$text"
    } else {
	$op "${city_prefix}$text" $sx $sy
    }
}

###############################################################################

proc georoster::presence_change {xlib from type x args} {
    variable options
    variable georoster

    if {![info exists georoster(jids,$xlib)]} {
	set georoster(jids,$xlib) {}
    }

    set jid [::xmpp::jid::stripResource $from]
    switch -- $type {
	error -
	subscribe -
	subscribed -
	unsubscribe -
	unsubscribed -
	probe {
	    return
	}

	unavailable {
	    if {!$options(show_last_known)} {
		if {[set x [lsearch -exact $georoster(jids,$xlib) $jid]] >= 0} {


		    set georoster(jids,$xlib) [lreplace $georoster(jids,$xlib) $x $x]
		}
		return
	    }

	    set to $jid
	}

	available -
	default {
	    set to $from
	}
    }

    if {($options(check_vcard)) \
	    && ([lsearch -exact $georoster(jids,$xlib) $jid] < 0) \
	    && ([string compare conference \
			[lindex [roster::get_category_and_subtype $xlib \
					 $jid] 0]])} {
	::xmpp::sendIQ $xlib get \
	    -query [::xmpp::xml::create vCard -xmlns vcard-temp] \
	    -to $to \
	    -command [list [namespace current]::parse_vcard .georoster.c $xlib $jid]

    }

    if {$options(automatic)} {
	open_georoster -raise 0
    }
    redraw .georoster.c
}

###############################################################################

proc georoster::parse_vcard {w xlib jid status xml} {
    variable geo3166
    variable georoster
    variable options

    if {$status ne "ok"} {
	return
    }

    ::xmpp::xml::split $xml tag xmlns attrs cdata subels

    array set info [list CTRY "" COUNTRY ""]
    foreach item $subels {
	::xmpp::xml::split $item tag xmlns attrs cdata subels

	switch -- $tag {
	    ADR {
		foreach item $subels {
		    ::xmpp::xml::split $item tag xmlns attrs cdata subels
		    array set info [list $tag [string trim $cdata]]
		}
	    }

	    EMAIL {
		set georoster(email,$xlib,$jid) [string trim $cdata]
	    }

	    GEO {
		foreach item $subels {
		    ::xmpp::xml::split $item tag xmlns attrs cdata subels
		    array set info [list $tag [string trim $cdata]]
		}
		if {([info exists info(LAT)]) \
			&& ([string is double -strict $info(LAT)]) \
			&& ([info exists info(LON)]) \
			&& ([string is double -strict $info(LON)])} {
		    update_jid $w $xlib $jid $info(LAT) $info(LON)
		    return
		}
	    }
	}
    }

    if {($info(CTRY) ne "") && ($info(COUNTRY) eq "")} {
	set info(COUNTRY) $info(CTRY)
    }
    unset info(CTRY)
    if {$info(COUNTRY) eq ""} {
	set args [list $jid]
	if {[info exists georoster(email,$xlib,$jid)]} {
	    lappend args $georoster(email,$xlib,$jid)
	}
	foreach addr $args {
	    if {([set x [string last . $addr]] > 0) \
		    && ([lsearch -exact $georoster(3166) \
				 [set c [string range $addr [expr $x+1] \
						end]]] >= 0)} {
		set info(COUNTRY) $c
		break
	    }
	}

	if {$info(COUNTRY) eq ""} {
	    set info(COUNTRY) $options(default_country)
	}
    }
    set info(COUNTRY) [set c [string tolower $info(COUNTRY)]]
    if {[info exists geo3166($c)]} {
	set info(COUNTRY) $geo3166($c)
    }
    foreach {k v} [array get info] {
	if {$v eq ""} {
	    unset info($k)
	}
    }

    switch -- $info(COUNTRY) {
	us {
	    set args {}
	    foreach {k v} [list PCODE zip REGION state LOCALITY city] {
		if {([info exists info($k)]) && ($info($k) ne "")} {
		    lappend args $v $info($k)
		}
	    }
	    if {[llength $args] > 0} {
		set query [eval ::http::formatQuery $args]

		if {![catch {
		    ::http::geturl \
			http://www.census.gov/cgi-bin/gazetteer?$query \
			-timeout 300 \
			-command [list [namespace current]::parse_vcard_aux $w \
				       $xlib $jid [array get info]]
		      }]} {
		    debugmsg georoster "async http: $xlib $jid"
		    return
		}
	    }
	}

	default {
	}
    }

    parse_vcard_aux2 $w $xlib $jid [array get info]
}

###############################################################################

proc georoster::parse_vcard_aux {w xlib jid xinfo httpT} {
    debugmsg georoster "  aux http: $xlib $jid"

    set data ""
    if {[set status [::http::status $httpT]] ne "ok"} {
	debugmsg georoster " gazetteer: $status"
    } elseif {![string match 2* [::http::ncode $httpT]]} {
	debugmsg georoster " gazetteer: [::http::code $httpT]"
    } else {
	set data [::http::data $httpT]
    }

    catch { ::http::cleanup $httpT }

    if {([set x [string first "lat=" $data]] > 0) \
	    && ([set x \
		     [string first "&wid" \
			     [set data [string range $data \
					       [expr $x+4] \
					       end]]]] > 0) \
	    && ([set x \
		     [string first "&lon=" \
			     [set data \
				  [string range $data 0 \
					  [expr $x-1]]]]] > 0) \
	    && ([string is double -strict \
			[set la [string range $data 0 [expr $x-1]]]]) \
	    && ([string is double -strict \
			[set lo [string range $data [expr $x+5] end]]])} {
	debugmsg georoster " gazetteer: $xlib $jid $la $lo"

	update_jid $w $xlib $jid $la $lo
	return
    }

    parse_vcard_aux2 $w $xlib $jid $xinfo
}

###############################################################################

................................................................................
    variable options

    debugmsg georoster "     vcard: $xlib $jid $xinfo"

    array set info $xinfo

    if {([info exists info(LOCALITY)]) \
	    && ([info exists options(coords,$info(COUNTRY))]) \
	    && (![catch { open $options(coords,$info(COUNTRY)) \
			       { RDONLY } } fd])} {
	if {[catch { string tolower $info(REGION) } region]} {
	    set region ""
	}
	set locality [string tolower $info(LOCALITY)]

	fconfigure $fd -encoding utf-8

	while {[gets $fd line] >= 0} {
	    if {[set x [string first "#" $line]] >= 0} {
		set line [string range $line 0 [expr $x-1]]
	    }
	    if {[catch { split $line "\t" } elems]} {
		continue
	    }

	    switch -- [llength $elems] {
		0 - 3 {
		    continue
		}

		2 {
		    if {$region eq [lindex $elems 1]} {
			set region [lindex $elems 0]
			debugmsg georoster \
				 "     vcard: normalize region to $region"
		    }
		    continue
		}

		4 - default {
		    if {($region eq [lindex $elems 0]) \
			    && ($locality eq [lindex $elems 1])} {
			if {([string is double -strict \
				     [set la [lindex $elems 2]]]) \
				&& ([string is double -strict \
					    [set lo [lindex $elems 3]]])} {
			    close $fd

			    debugmsg georoster "    coords: $xlib $jid $la $lo"
			    update_jid $w $xlib $jid $la $lo
			    return
			}

			debugmsg georoster "     vcard: invalid line: $line"
			break
		    }
		}
	    }
	}

	close $fd
    }

    hook::run georoster:locate_hook $xlib $jid \
	[list [namespace current]::update_jid $w $xlib $jid]
}

###############################################################################

proc georoster::update_jid {w xlib jid latitude longitude} {
    variable georoster

    if {[lsearch -exact $georoster(jids,$xlib) $jid] < 0} {
	lappend georoster(jids,$xlib) $jid
    }

    set georoster(la,$xlib,$jid) $latitude
    set georoster(lo,$xlib,$jid) $longitude
    redraw $w
}

................................................................................

proc georoster::move_b1p {c x y} {
    variable move

    set tags [$c gettags current]
    #puts $tags
    if {[lsearch -exact $tags icon] >= 0} {
	set x [$c canvasx $x]
	set y [$c canvasy $y]

	set move(startx) $x
	set move(starty) $y
	set move(lastx) $x
	set move(lasty) $y

	set xlib [string range [lsearch -inline -glob $tags xlib*] 4 end]
	set move(xlib) $xlib

	set jidtag [string range [lsearch -inline -glob $tags jid*] 3 end]
	set jid [tag_to_jid $jidtag]
	set move(jid) $jid
    } else {
	catch {unset move(jid)}
    }
}

###############################################################################

proc georoster::move_b1m {c x y} {
    variable move
    variable georoster
    variable status

    if {[info exists move(jid)]} {
	set ctag xlib$move(xlib)
	set tag jid[jid_to_tag $move(jid)]
	set x [$c canvasx $x]
	set y [$c canvasy $y]

	set xlib $move(xlib)
	set jid $move(jid)
	set lo $georoster(lo,$xlib,$jid)
	set la $georoster(la,$xlib,$jid)
	set oldx [x $lo $la]
	set oldy [y $lo $la]

	set newx [expr {$oldx + $x - $move(startx)}]
	set newy [expr {$oldy + $y - $move(starty)}]

	set newlo [lo $newx $newy]
	set newla [la $newx $newy]

	set status [::msgcat::mc "Latitude: %.2f  Longitude: %.2f" $newla $newlo]


	$c move icon&&$ctag&&$tag [expr {$x - $move(lastx)}] [expr {$y - $move(lasty)}]


	set move(lastx) $x
	set move(lasty) $y
    }
}

###############################################################################

proc georoster::move_b1r {c} {
    variable move
    variable georoster

    if {[info exists move(jid)]} {
	set ctag xlib$move(xlib)
	set tag jid[jid_to_tag $move(jid)]

	set xlib $move(xlib)
	set jid $move(jid)
	set x $move(lastx)
	set y $move(lasty)

	set lo $georoster(lo,$xlib,$jid)
	set la $georoster(la,$xlib,$jid)
	set oldx [x $lo $la]
	set oldy [y $lo $la]

	set newx [expr {$oldx + $x - $move(startx)}]
	set newy [expr {$oldy + $y - $move(starty)}]

	set newlo [lo $newx $newy]
	set newla [la $newx $newy]

	update_jid $c $xlib $jid $newla $newlo
    }
}

###############################################################################

proc georoster::delete {c x y} {
    variable georoster

    set tags [$c gettags current]
    #puts $tags
    if {[lsearch -exact $tags icon] >= 0} {
	set x [$c canvasx $x]
	set y [$c canvasy $y]

	set xlib [string range [lsearch -inline -glob $tags xlib*] 4 end]

	set jidtag [string range [lsearch -inline -glob $tags jid*] 3 end]
	set jid [tag_to_jid $jidtag]

	set idx [lsearch -exact $georoster(jids,$xlib) $jid]
	set georoster(jids,$xlib) [lreplace $georoster(jids,$xlib) $idx $idx]

	redraw $c
    }
}

###############################################################################

proc georoster::store {} {
    variable georoster

    foreach nxlib [array names georoster jids,*] {
	set xlib [string range $nxlib 5 end]

	set items($xlib) {}

	foreach jid $georoster(jids,$xlib) {
	    set lo $georoster(lo,$xlib,$jid)
	    set la $georoster(la,$xlib,$jid)

	    lappend items($xlib) [::xmpp::xml::create item \
					-attrs [list jid $jid lo $lo la $la]]
	}
    }

    foreach xlib [array names items] {
	::xmpp::private::store $xlib [list [::xmpp::xml::create query \
						-xmlns tkabber:georoster \
						-subelements $items($xlib)]]
    }
}

###############################################################################

proc georoster::init {xlib} {
    variable georoster

    if {![info exists georoster(jids,$xlib)]} {
	set georoster(jids,$xlib) {}
    }
}

###############################################################################

proc georoster::retrieve {xlib} {
    ::xmpp::private::retrieve $xlib [list [::xmpp::xml::create query \
						-xmlns tkabber:georoster]] \
	    -command [list [namespace current]::recv $xlib]
}

###############################################################################

proc georoster::recv {xlib status xmllist} {
    variable georoster

    if {$status != "ok"} {
	return
    }

    set georoster(jids,$xlib) {}

    foreach element $xmllist {
	::xmpp::xml::split $element tag xmlns attrs cdata subels

	foreach item $subels {
	    ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
	    set jid [::xmpp::xml::getAttr $sattrs jid]
	    if {$jid != ""} {
		lappend georoster(jids,$xlib) $jid
		set georoster(lo,$xlib,$jid) [::xmpp::xml::getAttr $sattrs lo]
		set georoster(la,$xlib,$jid) [::xmpp::xml::getAttr $sattrs la]
	    }
	}
    }
    after idle [list [namespace current]::redraw .georoster.c]
}

###############################################################################

proc georoster::compare_lo {namex namey} {
................................................................................

    set cities(list) {}

    set fd [open $options(citiesfile) r]
    fconfigure $fd -encoding utf-8

    while {![eof $fd]} {
	set s [gets $fd]

	if {[string index $s 0] == "#"} continue

	set la [lindex $s 0]
	set lo [lindex $s 1]
	set name [lindex $s 2]

	if {![string is double -strict $lo]} continue
	if {![string is double -strict $la]} continue

	lappend cities(list) $name
	set cities(lo,$name) $lo
	set cities(la,$name) $la
    }

    close $fd

    set cities(list) \
	[lsort -command [namespace current]::compare_lo $cities(list)]
}

###############################################################################

proc georoster::redraw_cities {c} {
    variable georoster
    variable cities
................................................................................
    if {![winfo exists $c]} return

    $c delete city

    if {$options(showcities) == "none"} return

    foreach name $cities(list) {
	set lo $cities(lo,$name)
	set la $cities(la,$name)
	#puts "$name: LO: $lo  LA: $la"
	set x [x $lo $la]
	set y [y $lo $la]

	#set tag [jid_to_tag $name]

	set id [$c create oval \
		    [expr {$x-2}] [expr {$y-2}] \
		    [expr {$x+2}] [expr {$y+2}] \
		    -tags [list city oval name$name] \
		    -outline red]

	$c bind $id <Any-Enter> \
	    +[list balloon::set_text $name]

	$c bind $id <Any-Motion> \
	    [list balloon::on_mouse_move $name %X %Y]

	$c bind $id <Any-Leave> {+
	    balloon::destroy
	}

	if {$options(showcities) == "all"} {
	    set txt [$c create text [expr {$x+4}] $y -text $name -anchor w \
			 -fill [option get [winfo parent $c] cityforeground GeoRoster] \

			 -tags [list city text name$name]]
	    lassign [$c bbox $txt] x1 y1 x2 y2
	    set overlap [$c find overlapping $x1 $y1 $x2 $y2]
	    foreach ym $moves {
		if {[llength $overlap] > 2} {
		    $c move $txt 0 $ym
		    lassign [$c bbox $txt] x1 y1 x2 y2
		    set overlap [$c find overlapping $x1 $y1 $x2 $y2]
		} else {
		    break
		}
	    }
	}
    }
    $c lower city icon
    $c lower text oval
}

###############################################################################

proc georoster::load_3166 {} {
    variable options
    variable geo3166
    variable georoster

    if {[catch { open $options(3166file) { RDONLY } } fd]} {
	return
    }

    while {[gets $fd line] >= 0} {
	if {[set x [string first "#" $line]] >= 0} {
	    set line [string range $line 0 [expr $x-1]]
	}
	if {[catch { split $line "\t" } elems]} {
	    continue
	}

	switch -- [llength $elems] {
	    0 - 1 {
		continue
	    }

	    2 - default {
		set geo3166([lindex $elems 1]) [set c [lindex $elems 0]]
		if {[lsearch -exact $georoster(3166) $c] < 0} {
		    lappend georoster(3166) $c
		}
	    }
	}
    }

    close $fd
}

##############################################################################

................................................................................
    set resource ""

    # TODO
    if {!$usetabbar} return

    set prio 0
    foreach page [.nb pages] {
	set path [ifacetk::nbpath $page]

	if {[string equal $path .georoster]} {
	    lappend session [list $prio $user $server $resource \
		[list [namespace current]::restore_window] \
	    ]
	}
	incr prio
    }
}

###############################################################################

# vim:ts=8:sw=4:sts=4:noet


|
<
<



<
<


<
<




|
|
|
|
>
|
|
|






|
>
|
|
|
|
|
|
|
|



|


|



|
>
|
|
|
|



|
|

|
|

|
|



|


|


|
|


|
>
|


|
|


|
|

|
|
|



|
|
|


|
|
|







 







|



|
|











|

|
|
|







 







|
|










|
|
|




|
|
|
|




|
|
|





>


|








|



|
|
|
|










|
|

|

|


|

|







 







|

|
|
|
|
|

|
|

|

|
|

|
|

|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|

|
|
|
|

|
|
|
|











|
|




|
|
>
|
|
|





|

|

|

|
|

|
|
|
|

|
|
|
|
|
|
>
|
|
<
>
|
|
|







|
|
|
|
|
|




|

|










|




|
|
|
|
|
|
|
|

|
|
|
>
>
|
|
|
|

|
|

|
|
|
|



|
|
|
|
|
|
|
|
>



|












|






|

|
|
|
|
|
|
|

|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|



|



|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|



|


|
|
|



|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|

|
|












|

|

|





|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|







 







|
|
|
|
|
|
|

|

|
|
|
|
|
|
|

|
|
|
|

|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|

|
|
|
|

|
|
|
|
|
|

|



|








|







 







|
|

|
|
|
|

|
|

|
|
|

|











|
|
|
|

|
|
|
|
|
|

|
|

|
|

|
>

|
>

|
|










|
|

|
|
|
|

|
|
|
|

|
|

|
|

|











|
|

|

|
|

|
|

|









|

|

|
|
|

|
|
|



|
|
|









|







|
|








|





|

|
|
|
|
|
|
|
|
|







 







|

|

|
|
|

|
|

|
|
|





|







 







|
|
|
|
|

|

|
|
|
|
|

|
|

|
|

|
|
|

|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|










|



|
|
|
|
|
|

|
|
|
|

|
|
|
|
|
|
|







 







|

|
|
|
|
|
|



<
<
|
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
...
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
...
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
...
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
...
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
...
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
...
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
...
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
....
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108


1109
# georoster.tcl --
#
#       This file implements Georoster plugin for the Tkabber XMPP client.



package require msgcat



option add *GeoRoster.cityforeground green3 widgetDefault



namespace eval georoster {
    ::msgcat::mcload [file join [file dirname [info script]] msgs]

    if {![::plugins::is_registered georoster]} {
        ::plugins::register georoster \
                            -namespace [namespace current] \
                            -source [info script] \
                            -description [::msgcat::mc "Whether the Georoster\
                                                        plugin is loaded."] \
                            -loadcommand [namespace code load] \
                            -unloadcommand [namespace code unload]
        return
    }

    variable georoster
    variable options

    if {![info exists options(citiesfile)]} {
        set options(citiesfile) [file join [file dirname [info script]] \
                                           cities earth]
        foreach pr [::msgcat::mcpreferences] {
            set f [file join [file dirname [info script]] cities "earth.$pr"]
            if {[file exists $f]} {
                set options(citiesfile) $f
                break
            }
        }
        unset pr f
    }

    if {![info exists options(3166file)]} {
        set options(3166file) [file join [file dirname [info script]] iso3166]
    }
    if {![info exists georoster(3166)]} {
        set georoster(3166) {}
    }

    foreach file [glob -nocomplain \
                       [file join [file dirname [info script]] \
                                  coords ??.coords]] {
        set c [file tail [file rootname $file]]
        if {![info exists options(coords,$c)]} {
            set options(coords,$c) $file
        }
    }

    if {![info exists options(mapfile)]} {
        set options(mapfile) \
            [file join [file dirname [info script]] maps bwmap2.gif]

        proc lo {x y} {expr {($x - 649)*18/65 + 10}}
        proc la {x y} {expr {(371 - $y)*9/40}}

        proc x {lo la} {expr {649+(($lo-10)*65/18)}}
        proc y {lo la} {expr {371-($la * 40/9)}}
    }

    custom::defgroup Plugins [::msgcat::mc "Plugins options."] \
        -group Tkabber

    custom::defgroup Georoster [::msgcat::mc "Georoster plugin options."] \
        -group Plugins

    custom::defvar options(automatic) 0 \
        [::msgcat::mc "Automatically open Georoster window."] \
        -group Georoster -type boolean

    custom::defvar options(check_vcard) 0 \
        [::msgcat::mc "Automatically look at vCard to find users\
                       coordinates."] \
        -group Georoster -type boolean

    custom::defvar options(show_last_known) 0 \
        [::msgcat::mc "Display users who are no longer available."] \
        -group Georoster -type boolean

    custom::defvar options(default_country) us \
        [::msgcat::mc "Default country to use when looking at a vCard."] \
        -group Georoster -type string

    set opt2label_list [list none [::msgcat::mc "Don't show cities"] \
                             markers [::msgcat::mc "Show only city markers"] \
                             all [::msgcat::mc "Show city markers and names"]]

    array set opt2label $opt2label_list

    array set label2opt [list [::msgcat::mc "Don't show cities"] none \
                              [::msgcat::mc "Show only city markers"] markers \
                              [::msgcat::mc "Show city markers and names"] all]

    custom::defvar options(showcities) all \
        [::msgcat::mc "Specify how to show cities at the map."] \
        -group Georoster -type options \
        -values $opt2label_list -command [namespace current]::set_showcities

    variable showcities $opt2label($options(showcities))
}

package require http 2
package require xmpp::private

................................................................................
    hook::add finload_hook [namespace current]::setup
    hook::add client_presence_hook [namespace current]::presence_change
    hook::add connected_hook [namespace current]::init 1
    hook::add connected_hook [namespace current]::retrieve
    hook::add save_session_hook [namespace current]::save_session

    trace variable [namespace current]::showcities w \
                   [namespace current]::set_option_showcities
    setup

    foreach xlib [connections] {
        init $xlib
        retrieve $xlib
    }
}

proc georoster::unload {} {
    hook::remove finload_hook [namespace current]::setup
    hook::remove client_presence_hook [namespace current]::presence_change
    hook::remove connected_hook [namespace current]::init 1
    hook::remove connected_hook [namespace current]::retrieve
    hook::remove save_session_hook [namespace current]::save_session

    trace vdelete [namespace current]::showcities w \
                  [namespace current]::set_option_showcities
    catch {
        set m [.mainframe getmenu roster]
        set idx [$m index [::msgcat::mc "Georoster"]]
        $m delete $idx
    }

    destroy_win .georoster

    variable mapimage
    variable georoster
    variable status
................................................................................

    load_cities
    load_3166

    set m [.mainframe getmenu roster]

    $m add command \
        -label [::msgcat::mc "Georoster"] \
        -command [list [namespace current]::open_georoster -raise 1]
}

###############################################################################

proc georoster::open_georoster {args} {
    variable options
    variable mapimage

    set raise 0
    foreach {key val} $args {
        switch -- $key {
            -raise { set raise $val }
        }
    }

    set w .georoster
    if {[winfo exists $w]} {
        if {$raise} {
            raise_win $w
        }
        return
    }

    set title [::msgcat::mc "Georoster"]
    add_win $w -title $title \
               -tabtitle $title \
               -class GeoRoster \
               -raise $raise

    set sw [ScrolledWindow $w.sw]
    pack $sw -side top -fill both -expand yes
    set c [canvas $w.c]
    $sw setwidget $c
    bindscroll $c

    DropSite::register $c -droptypes {JID {}} \
        -dropcmd [list [namespace current]::drop_jid $c]

    set tb [frame $w.tb]
    pack $tb -side bottom -fill x

    set status [label $tb.status -textvariable [namespace current]::status]
    pack $status -side left -anchor w

    set store [button $tb.store -text [::msgcat::mc "Store"] \
                   -command [namespace current]::store]
    pack $store -side right

    set cities [OptionMenu $tb.cities \
                    [namespace current]::showcities \
                    [::msgcat::mc "Don't show cities"] \
                    [::msgcat::mc "Show only city markers"] \
                    [::msgcat::mc "Show city markers and names"]]
    pack $tb.cities -side right


    $c create image 0 0 -image $mapimage -anchor nw -tags map
    $w.c configure -scrollregion [$w.c bbox all]

    bind $c <Motion> [list [namespace current]::on_mouse_move $c %x %y]
    bind $c <Leave> [list set [namespace current]::status ""]

    bind $c <ButtonPress-1> \
        [list [namespace current]::move_b1p \
             [double% $c] %x %y]
    bind $c <B1-Motion> [list [namespace current]::move_b1m \
                             [double% $c] %x %y]
    bind $c <ButtonRelease-1> \
        [list [namespace current]::move_b1r [double% $c]]

    bind $c <<PasteSelection>> \
        [list [namespace current]::delete [double% $c] %x %y]
    bind $c <Control-ButtonPress-1> \
        [list [namespace current]::delete [double% $c] %x %y]

    redraw $c
}

###############################################################################

proc georoster::on_mouse_move {c x y} {
................................................................................
    if {![winfo exists $c]} return

    $c delete icon

    redraw_cities $c

    foreach nxlib [array names georoster jids,*] {
        set xlib [string range $nxlib 5 end]

        foreach jid $georoster(jids,$xlib) {
            set lo $georoster(lo,$xlib,$jid)
            set la $georoster(la,$xlib,$jid)
            set x [x $lo $la]
            set y [y $lo $la]

            set icon roster/user/unavailable
            catch {set icon [ifacetk::roster::get_jid_icon $xlib $jid]}

            set tag [jid_to_tag $jid]

            $c create image $x $y -image $icon \
                -tags [list icon xlib$xlib jid$tag] -anchor c

            set doubledjid [double% $jid]
            set jids [ifacetk::roster::get_jids_of_user $xlib $jid]

            if {[llength $jids] > 0} {
                set doubledjids [double% $jids]
            } else {
                set jids [list $jid]
                # TODO: Turn into metacontacts
                #if {$ifacetk::roster::use_aliases && \
                #        [info exists roster::aliases($jid)]} {
                #    set jids [concat $jids $roster::aliases($jid)]
                #}
                set doubledjids [double% $jids]
            }

            #$c bind jid$tag <Any-Enter> \
            #    +[list eval balloon::set_text \
            #         \[roster::jids_popup_info [list $doubledjids]\]]
            #
            #$c bind jid$tag <Any-Motion> \
            #    [list eval balloon::on_mouse_move \
            #        \[roster::jids_popup_info [list $doubledjids]\] %X %Y]

            $c bind jid$tag <Any-Enter> \
                +[list [namespace current]::set_balloon_text \
                      balloon::set_text \
                      $xlib $doubledjid %X %Y]

            $c bind jid$tag <Any-Motion> \
                [list [namespace current]::set_balloon_text \
                     balloon::on_mouse_move \
                     $xlib $doubledjid %X %Y]

            $c bind jid$tag <Any-Leave> {+
                balloon::destroy
            }
        }
    }
}

###############################################################################

proc georoster::set_balloon_text {op xlib jid sx sy} {
    set c .georoster.c
    set x [$c canvasx [expr {$sx - [winfo rootx $c]}]]
    set y [$c canvasy [expr {$sy - [winfo rooty $c]}]]

    set ids [$c find overlapping \
                 [expr {$x-2}] [expr {$y-2}] \
                 [expr {$x+2}] [expr {$y+2}]]

    set city_prefix ""

    foreach id $ids {
        set tags [$c gettags $id]
        if {[lsearch -exact $tags city] >= 0 && \
                [lsearch -exact $tags oval] >= 0} {
            set name [string range [lsearch -inline -glob $tags name*] 4 end]
            append city_prefix "$name\n"
        }
    }

    set all_jids {}

    foreach id $ids {
        set tags [$c gettags $id]

        if {[lsearch -exact $tags icon] < 0} continue

        set xlib [string range [lsearch -inline -glob $tags xlib*] 4 end]

        set jidtag [string range [lsearch -inline -glob $tags jid*] 3 end]
        set jid [tag_to_jid $jidtag]

        set jids {}
        foreach j [ifacetk::roster::get_jids_of_user $xlib $jid] {
            lappend jids [list $xlib $j]
        }

        if {[llength $jids] == 0} {
            if {[catch { list [list $xlib $jid] } jids]} {
                set jids {}
            }
            # TODO: Turn into metacontacts
            #if {$ifacetk::roster::use_aliases && \
            #        [info exists roster::aliases($jid)]} {
            #   foreach j $roster::aliases($jid) {
            #       lappend jids [list $xlib $j]

            #   }
            #}
        }
        set all_jids [concat $all_jids $jids]
    }

    set all_jids [lsort -unique $all_jids]

    set text ""
    set i 0
    foreach cj $all_jids {
        lassign $cj xlib j
        append text "\n"
        append text [::msgcat::mc "Connection: %s" [connection_jid $xlib]]
        append text "\n"
        append text [ifacetk::roster::user_popup_info $xlib $j $i]
        incr i
    }
    set text [string trimleft $text "\n"]

    if {$op == "balloon::set_text"} {
        $op "${city_prefix}$text"
    } else {
        $op "${city_prefix}$text" $sx $sy
    }
}

###############################################################################

proc georoster::presence_change {xlib from type x args} {
    variable options
    variable georoster

    if {![info exists georoster(jids,$xlib)]} {
        set georoster(jids,$xlib) {}
    }

    set jid [::xmpp::jid::stripResource $from]
    switch -- $type {
        error -
        subscribe -
        subscribed -
        unsubscribe -
        unsubscribed -
        probe {
            return
        }

        unavailable {
            if {!$options(show_last_known)} {
                set x [lsearch -exact $georoster(jids,$xlib) $jid]
                if {$x >= 0} {
                    set georoster(jids,$xlib) \
                        [lreplace $georoster(jids,$xlib) $x $x]
                }
                return
            }

            set to $jid
        }

        available -
        default {
            set to $from
        }
    }

    if {($options(check_vcard)) \
            && ([lsearch -exact $georoster(jids,$xlib) $jid] < 0) \
            && ([string compare conference \
                        [lindex [roster::get_category_and_subtype $xlib \
                                         $jid] 0]])} {
        ::xmpp::sendIQ $xlib get \
            -query [::xmpp::xml::create vCard -xmlns vcard-temp] \
            -to $to \
            -command [list [namespace current]::parse_vcard .georoster.c \
                           $xlib $jid]
    }

    if {$options(automatic)} {
        open_georoster -raise 0
    }
    redraw .georoster.c
}

###############################################################################

proc georoster::parse_vcard {w xlib jid status xml} {
    variable geo3166
    variable georoster
    variable options

    if {$status ne "ok"} {
        return
    }

    ::xmpp::xml::split $xml tag xmlns attrs cdata subels

    array set info [list CTRY "" COUNTRY ""]
    foreach item $subels {
        ::xmpp::xml::split $item tag xmlns attrs cdata subels

        switch -- $tag {
            ADR {
                foreach item $subels {
                    ::xmpp::xml::split $item tag xmlns attrs cdata subels
                    array set info [list $tag [string trim $cdata]]
                }
            }

            EMAIL {
                set georoster(email,$xlib,$jid) [string trim $cdata]
            }

            GEO {
                foreach item $subels {
                    ::xmpp::xml::split $item tag xmlns attrs cdata subels
                    array set info [list $tag [string trim $cdata]]
                }
                if {([info exists info(LAT)]) \
                        && ([string is double -strict $info(LAT)]) \
                        && ([info exists info(LON)]) \
                        && ([string is double -strict $info(LON)])} {
                    update_jid $w $xlib $jid $info(LAT) $info(LON)
                    return
                }
            }
        }
    }

    if {($info(CTRY) ne "") && ($info(COUNTRY) eq "")} {
        set info(COUNTRY) $info(CTRY)
    }
    unset info(CTRY)
    if {$info(COUNTRY) eq ""} {
        set args [list $jid]
        if {[info exists georoster(email,$xlib,$jid)]} {
            lappend args $georoster(email,$xlib,$jid)
        }
        foreach addr $args {
            if {([set x [string last . $addr]] > 0) \
                    && ([lsearch -exact $georoster(3166) \
                                 [set c [string range $addr [expr $x+1] \
                                                end]]] >= 0)} {
                set info(COUNTRY) $c
                break
            }
        }

        if {$info(COUNTRY) eq ""} {
            set info(COUNTRY) $options(default_country)
        }
    }
    set info(COUNTRY) [set c [string tolower $info(COUNTRY)]]
    if {[info exists geo3166($c)]} {
        set info(COUNTRY) $geo3166($c)
    }
    foreach {k v} [array get info] {
        if {$v eq ""} {
            unset info($k)
        }
    }

    switch -- $info(COUNTRY) {
        us {
            set args {}
            foreach {k v} [list PCODE zip REGION state LOCALITY city] {
                if {([info exists info($k)]) && ($info($k) ne "")} {
                    lappend args $v $info($k)
                }
            }
            if {[llength $args] > 0} {
                set query [eval ::http::formatQuery $args]

                if {![catch {
                    ::http::geturl \
                        http://www.census.gov/cgi-bin/gazetteer?$query \
                        -timeout 300 \
                        -command [list [namespace current]::parse_vcard_aux \
                                       $w $xlib $jid [array get info]]
                      }]} {
                    debugmsg georoster "async http: $xlib $jid"
                    return
                }
            }
        }

        default {
        }
    }

    parse_vcard_aux2 $w $xlib $jid [array get info]
}

###############################################################################

proc georoster::parse_vcard_aux {w xlib jid xinfo httpT} {
    debugmsg georoster "  aux http: $xlib $jid"

    set data ""
    if {[set status [::http::status $httpT]] ne "ok"} {
        debugmsg georoster " gazetteer: $status"
    } elseif {![string match 2* [::http::ncode $httpT]]} {
        debugmsg georoster " gazetteer: [::http::code $httpT]"
    } else {
        set data [::http::data $httpT]
    }

    catch { ::http::cleanup $httpT }

    if {([set x [string first "lat=" $data]] > 0) \
            && ([set x \
                     [string first "&wid" \
                             [set data [string range $data \
                                               [expr $x+4] \
                                               end]]]] > 0) \
            && ([set x \
                     [string first "&lon=" \
                             [set data \
                                  [string range $data 0 \
                                          [expr $x-1]]]]] > 0) \
            && ([string is double -strict \
                        [set la [string range $data 0 [expr $x-1]]]]) \
            && ([string is double -strict \
                        [set lo [string range $data [expr $x+5] end]]])} {
        debugmsg georoster " gazetteer: $xlib $jid $la $lo"

        update_jid $w $xlib $jid $la $lo
        return
    }

    parse_vcard_aux2 $w $xlib $jid $xinfo
}

###############################################################################

................................................................................
    variable options

    debugmsg georoster "     vcard: $xlib $jid $xinfo"

    array set info $xinfo

    if {([info exists info(LOCALITY)]) \
            && ([info exists options(coords,$info(COUNTRY))]) \
            && (![catch { open $options(coords,$info(COUNTRY)) \
                               { RDONLY } } fd])} {
        if {[catch { string tolower $info(REGION) } region]} {
            set region ""
        }
        set locality [string tolower $info(LOCALITY)]

        fconfigure $fd -encoding utf-8

        while {[gets $fd line] >= 0} {
            if {[set x [string first "#" $line]] >= 0} {
                set line [string range $line 0 [expr $x-1]]
            }
            if {[catch { split $line "\t" } elems]} {
                continue
            }

            switch -- [llength $elems] {
                0 - 3 {
                    continue
                }

                2 {
                    if {$region eq [lindex $elems 1]} {
                        set region [lindex $elems 0]
                        debugmsg georoster \
                                 "     vcard: normalize region to $region"
                    }
                    continue
                }

                4 - default {
                    if {($region eq [lindex $elems 0]) \
                            && ($locality eq [lindex $elems 1])} {
                        if {([string is double -strict \
                                     [set la [lindex $elems 2]]]) \
                                && ([string is double -strict \
                                            [set lo [lindex $elems 3]]])} {
                            close $fd

                            debugmsg georoster "    coords: $xlib $jid $la $lo"
                            update_jid $w $xlib $jid $la $lo
                            return
                        }

                        debugmsg georoster "     vcard: invalid line: $line"
                        break
                    }
                }
            }
        }

        close $fd
    }

    hook::run georoster:locate_hook $xlib $jid \
        [list [namespace current]::update_jid $w $xlib $jid]
}

###############################################################################

proc georoster::update_jid {w xlib jid latitude longitude} {
    variable georoster

    if {[lsearch -exact $georoster(jids,$xlib) $jid] < 0} {
        lappend georoster(jids,$xlib) $jid
    }

    set georoster(la,$xlib,$jid) $latitude
    set georoster(lo,$xlib,$jid) $longitude
    redraw $w
}

................................................................................

proc georoster::move_b1p {c x y} {
    variable move

    set tags [$c gettags current]
    #puts $tags
    if {[lsearch -exact $tags icon] >= 0} {
        set x [$c canvasx $x]
        set y [$c canvasy $y]

        set move(startx) $x
        set move(starty) $y
        set move(lastx) $x
        set move(lasty) $y

        set xlib [string range [lsearch -inline -glob $tags xlib*] 4 end]
        set move(xlib) $xlib

        set jidtag [string range [lsearch -inline -glob $tags jid*] 3 end]
        set jid [tag_to_jid $jidtag]
        set move(jid) $jid
    } else {
        catch {unset move(jid)}
    }
}

###############################################################################

proc georoster::move_b1m {c x y} {
    variable move
    variable georoster
    variable status

    if {[info exists move(jid)]} {
        set ctag xlib$move(xlib)
        set tag jid[jid_to_tag $move(jid)]
        set x [$c canvasx $x]
        set y [$c canvasy $y]

        set xlib $move(xlib)
        set jid $move(jid)
        set lo $georoster(lo,$xlib,$jid)
        set la $georoster(la,$xlib,$jid)
        set oldx [x $lo $la]
        set oldy [y $lo $la]

        set newx [expr {$oldx + $x - $move(startx)}]
        set newy [expr {$oldy + $y - $move(starty)}]

        set newlo [lo $newx $newy]
        set newla [la $newx $newy]

        set status [::msgcat::mc "Latitude: %.2f  Longitude: %.2f" \
                                 $newla $newlo]

        $c move icon&&$ctag&&$tag [expr {$x - $move(lastx)}] \
                                  [expr {$y - $move(lasty)}]

        set move(lastx) $x
        set move(lasty) $y
    }
}

###############################################################################

proc georoster::move_b1r {c} {
    variable move
    variable georoster

    if {[info exists move(jid)]} {
        set ctag xlib$move(xlib)
        set tag jid[jid_to_tag $move(jid)]

        set xlib $move(xlib)
        set jid $move(jid)
        set x $move(lastx)
        set y $move(lasty)

        set lo $georoster(lo,$xlib,$jid)
        set la $georoster(la,$xlib,$jid)
        set oldx [x $lo $la]
        set oldy [y $lo $la]

        set newx [expr {$oldx + $x - $move(startx)}]
        set newy [expr {$oldy + $y - $move(starty)}]

        set newlo [lo $newx $newy]
        set newla [la $newx $newy]

        update_jid $c $xlib $jid $newla $newlo
    }
}

###############################################################################

proc georoster::delete {c x y} {
    variable georoster

    set tags [$c gettags current]
    #puts $tags
    if {[lsearch -exact $tags icon] >= 0} {
        set x [$c canvasx $x]
        set y [$c canvasy $y]

        set xlib [string range [lsearch -inline -glob $tags xlib*] 4 end]

        set jidtag [string range [lsearch -inline -glob $tags jid*] 3 end]
        set jid [tag_to_jid $jidtag]

        set idx [lsearch -exact $georoster(jids,$xlib) $jid]
        set georoster(jids,$xlib) [lreplace $georoster(jids,$xlib) $idx $idx]

        redraw $c
    }
}

###############################################################################

proc georoster::store {} {
    variable georoster

    foreach nxlib [array names georoster jids,*] {
        set xlib [string range $nxlib 5 end]

        set items($xlib) {}

        foreach jid $georoster(jids,$xlib) {
            set lo $georoster(lo,$xlib,$jid)
            set la $georoster(la,$xlib,$jid)

            lappend items($xlib) [::xmpp::xml::create item \
                                        -attrs [list jid $jid lo $lo la $la]]
        }
    }

    foreach xlib [array names items] {
        ::xmpp::private::store $xlib [list [::xmpp::xml::create query \
                                                -xmlns tkabber:georoster \
                                                -subelements $items($xlib)]]
    }
}

###############################################################################

proc georoster::init {xlib} {
    variable georoster

    if {![info exists georoster(jids,$xlib)]} {
        set georoster(jids,$xlib) {}
    }
}

###############################################################################

proc georoster::retrieve {xlib} {
    ::xmpp::private::retrieve $xlib [list [::xmpp::xml::create query \
                                                -xmlns tkabber:georoster]] \
            -command [list [namespace current]::recv $xlib]
}

###############################################################################

proc georoster::recv {xlib status xmllist} {
    variable georoster

    if {$status != "ok"} {
        return
    }

    set georoster(jids,$xlib) {}

    foreach element $xmllist {
        ::xmpp::xml::split $element tag xmlns attrs cdata subels

        foreach item $subels {
            ::xmpp::xml::split $item stag sxmlns sattrs scdata ssubels
            set jid [::xmpp::xml::getAttr $sattrs jid]
            if {$jid != ""} {
                lappend georoster(jids,$xlib) $jid
                set georoster(lo,$xlib,$jid) [::xmpp::xml::getAttr $sattrs lo]
                set georoster(la,$xlib,$jid) [::xmpp::xml::getAttr $sattrs la]
            }
        }
    }
    after idle [list [namespace current]::redraw .georoster.c]
}

###############################################################################

proc georoster::compare_lo {namex namey} {
................................................................................

    set cities(list) {}

    set fd [open $options(citiesfile) r]
    fconfigure $fd -encoding utf-8

    while {![eof $fd]} {
        set s [gets $fd]

        if {[string index $s 0] == "#"} continue

        set la [lindex $s 0]
        set lo [lindex $s 1]
        set name [lindex $s 2]

        if {![string is double -strict $lo]} continue
        if {![string is double -strict $la]} continue

        lappend cities(list) $name
        set cities(lo,$name) $lo
        set cities(la,$name) $la
    }

    close $fd

    set cities(list) \
        [lsort -command [namespace current]::compare_lo $cities(list)]
}

###############################################################################

proc georoster::redraw_cities {c} {
    variable georoster
    variable cities
................................................................................
    if {![winfo exists $c]} return

    $c delete city

    if {$options(showcities) == "none"} return

    foreach name $cities(list) {
        set lo $cities(lo,$name)
        set la $cities(la,$name)
        #puts "$name: LO: $lo  LA: $la"
        set x [x $lo $la]
        set y [y $lo $la]

        #set tag [jid_to_tag $name]

        set id [$c create oval \
                    [expr {$x-2}] [expr {$y-2}] \
                    [expr {$x+2}] [expr {$y+2}] \
                    -tags [list city oval name$name] \
                    -outline red]

        $c bind $id <Any-Enter> \
            +[list balloon::set_text $name]

        $c bind $id <Any-Motion> \
            [list balloon::on_mouse_move $name %X %Y]

        $c bind $id <Any-Leave> {+
            balloon::destroy
        }

        if {$options(showcities) == "all"} {
            set txt [$c create text [expr {$x+4}] $y -text $name -anchor w \
                         -fill [option get [winfo parent $c] cityforeground \
                                           GeoRoster] \
                         -tags [list city text name$name]]
            lassign [$c bbox $txt] x1 y1 x2 y2
            set overlap [$c find overlapping $x1 $y1 $x2 $y2]
            foreach ym $moves {
                if {[llength $overlap] > 2} {
                    $c move $txt 0 $ym
                    lassign [$c bbox $txt] x1 y1 x2 y2
                    set overlap [$c find overlapping $x1 $y1 $x2 $y2]
                } else {
                    break
                }
            }
        }
    }
    catch {$c lower city icon}
    catch {$c lower text oval}
}

###############################################################################

proc georoster::load_3166 {} {
    variable options
    variable geo3166
    variable georoster

    if {[catch { open $options(3166file) { RDONLY } } fd]} {
        return
    }

    while {[gets $fd line] >= 0} {
        if {[set x [string first "#" $line]] >= 0} {
            set line [string range $line 0 [expr $x-1]]
        }
        if {[catch { split $line "\t" } elems]} {
            continue
        }

        switch -- [llength $elems] {
            0 - 1 {
                continue
            }

            2 - default {
                set geo3166([lindex $elems 1]) [set c [lindex $elems 0]]
                if {[lsearch -exact $georoster(3166) $c] < 0} {
                    lappend georoster(3166) $c
                }
            }
        }
    }

    close $fd
}

##############################################################################

................................................................................
    set resource ""

    # TODO
    if {!$usetabbar} return

    set prio 0
    foreach page [.nb pages] {
        set path [ifacetk::nbpath $page]

        if {[string equal $path .georoster]} {
            lappend session [list $prio $user $server $resource \
                [list [namespace current]::restore_window] \
            ]
        }
        incr prio
    }
}



# vim:ts=8:sw=4:sts=4:et

Name change from georoster/bwmap2.gif to georoster/maps/bwmap2.gif.

cannot compute difference between binary files

Name change from georoster/bwmap4.gif to georoster/maps/bwmap4.gif.

cannot compute difference between binary files

Name change from georoster/colormap.jpg to georoster/maps/colormap.jpg.

cannot compute difference between binary files

Name change from georoster/darkmap.gif to georoster/maps/darkmap.gif.

cannot compute difference between binary files

Changes to georoster/msgs/de.msg.

1
2
3
4
5
6
7
8


9

10
11

12

13
14

15
16

17
18

19

20
21
22



# de.msg --
#
#	German messages for the Georoster Tkabber plugin.
#
# Author: Roger Sondermann
# Last-Modified: 13.03.2009

::msgcat::mcset de "Automatically look at vCard to find users coordinates." "Für die Koordinaten des Benutzers automatisch in seine Visitenkarte schauen."


::msgcat::mcset de "Automatically open Georoster window."                   "Das Georoster-Fenster automatisch öffnen."

::msgcat::mcset de "Connection: %s"                                         "Verbindung: %s"
::msgcat::mcset de "Default country to use when looking at a vCard."        "Voreingestelltes Land beim Schauen in die Visitenkarte."

::msgcat::mcset de "Display users who are no longer available."             "Auch Benutzer, die nicht länger verfügbar sind, anzeigen."

::msgcat::mcset de "Don't show cities"                                      "Keine Städte anzeigen"
::msgcat::mcset de "Georoster plugin options."                              "Optionen für das Georoster-Plugin."

::msgcat::mcset de "Georoster"                                              "Georoster"
::msgcat::mcset de "Latitude: %.2f  Longitude: %.2f"                        "Breitengrad: %.2f / Längengrad: %.2f"

::msgcat::mcset de "Plugins options."                                       "Optionen für Plugins."
::msgcat::mcset de "Show city markers and names"                            "Markierungen und Namen anzeigen"

::msgcat::mcset de "Show only city markers"                                 "Markierungen anzeigen"

::msgcat::mcset de "Specify how to show cities at the map."                 "Angeben, wie Städte auf der Karte angezeigt werden sollen."
::msgcat::mcset de "Store"                                                  "Speichern"
::msgcat::mcset de "Whether the Georoster plugin is loaded."                "Georoster-Plugin laden."





|




|
>
>
|
>
|
|
>
|
>
|
|
>
|
|
>
|
|
>
|
>
|
|
|
>
>
>
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
# de.msg --
#
#       German messages for the Georoster Tkabber plugin.
#
# Author: Roger Sondermann
# Last-Modified: 13.03.2009

::msgcat::mcset de "Automatically look at vCard to find users coordinates." \
        "Für die Koordinaten des Benutzers automatisch in seine Visitenkarte\
        schauen."
::msgcat::mcset de "Automatically open Georoster window." \
        "Das Georoster-Fenster automatisch öffnen."
::msgcat::mcset de "Connection: %s" "Verbindung: %s"
::msgcat::mcset de "Default country to use when looking at a vCard." \
        "Voreingestelltes Land beim Schauen in die Visitenkarte."
::msgcat::mcset de "Display users who are no longer available." \
        "Auch Benutzer, die nicht länger verfügbar sind, anzeigen."
::msgcat::mcset de "Don't show cities" "Keine Städte anzeigen"
::msgcat::mcset de "Georoster plugin options." \
        "Optionen für das Georoster-Plugin."
::msgcat::mcset de "Georoster" "Georoster"
::msgcat::mcset de "Latitude: %.2f  Longitude: %.2f" \
        "Breitengrad: %.2f / Längengrad: %.2f"
::msgcat::mcset de "Plugins options." "Optionen für Plugins."
::msgcat::mcset de "Show city markers and names" \
        "Markierungen und Namen anzeigen"
::msgcat::mcset de "Show only city markers" "Markierungen anzeigen"
::msgcat::mcset de "Specify how to show cities at the map." \
        "Angeben, wie Städte auf der Karte angezeigt werden sollen."
::msgcat::mcset de "Store" "Speichern"
::msgcat::mcset de "Whether the Georoster plugin is loaded." \
        "Georoster-Plugin laden."

# vim:ft=tcl:ts=8:sw=4:sts=4:et

Changes to georoster/msgs/es.msg.

1
2
3
4
5
6
7

8

9
10

11

12
13
14
15

16
17

18

19

20
21



# es.msg --
#
#	Spanish messages for the Georoster Tkabber plugin.
#
# Author: Badlop

::msgcat::mcset es "Automatically look at vCard to find users coordinates." "Mirar automáticamente las coordenadas del otro contacto en su vCard."

::msgcat::mcset es "Automatically open Georoster window." "Abrir automáticamente la ventana de Georoster."

::msgcat::mcset es "Connection: %s" "Conexión: %s"
::msgcat::mcset es "Default country to use when looking at a vCard." "País por defecto para usar cuando se busca un vCard."

::msgcat::mcset es "Display users who are no longer available." "Mostrar usuarios que no están disponibles."

::msgcat::mcset es "Don't show cities" "No mostrar ciudades"
::msgcat::mcset es "Georoster plugin options." "Opciones del plugin Georoster."
::msgcat::mcset es "Georoster" "Georoster"
::msgcat::mcset es "Latitude: %.2f  Longitude: %.2f" "Latitud: %.2f  Longitud: %.2f" 

::msgcat::mcset es "Plugins options." "Opciones de plugins."
::msgcat::mcset es "Show city markers and names" "Mostrar marcadores y nombres de las ciudades"

::msgcat::mcset es "Show only city markers" "Mostrar solo los marcadores de ciudades"

::msgcat::mcset es "Specify how to show cities at the map." "Especificar como mostrar las ciudades en el mapa."

::msgcat::mcset es "Store" "Almacenar"
::msgcat::mcset es "Whether the Georoster plugin is loaded." "Cargar el plugin Georoster."





|



|
>
|
>

|
>
|
>



|
>

|
>
|
>
|
>

|
>
>
>
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
# es.msg --
#
#       Spanish messages for the Georoster Tkabber plugin.
#
# Author: Badlop

::msgcat::mcset es "Automatically look at vCard to find users coordinates." \
        "Mirar automáticamente las coordenadas del otro contacto en su vCard."
::msgcat::mcset es "Automatically open Georoster window." \
        "Abrir automáticamente la ventana de Georoster."
::msgcat::mcset es "Connection: %s" "Conexión: %s"
::msgcat::mcset es "Default country to use when looking at a vCard." \
        "País por defecto para usar cuando se busca un vCard."
::msgcat::mcset es "Display users who are no longer available." \
        "Mostrar usuarios que no están disponibles."
::msgcat::mcset es "Don't show cities" "No mostrar ciudades"
::msgcat::mcset es "Georoster plugin options." "Opciones del plugin Georoster."
::msgcat::mcset es "Georoster" "Georoster"
::msgcat::mcset es "Latitude: %.2f  Longitude: %.2f" \
        "Latitud: %.2f  Longitud: %.2f" 
::msgcat::mcset es "Plugins options." "Opciones de plugins."
::msgcat::mcset es "Show city markers and names" \
        "Mostrar marcadores y nombres de las ciudades"
::msgcat::mcset es "Show only city markers" \
        "Mostrar solo los marcadores de ciudades"
::msgcat::mcset es "Specify how to show cities at the map." \
        "Especificar como mostrar las ciudades en el mapa."
::msgcat::mcset es "Store" "Almacenar"
::msgcat::mcset es "Whether the Georoster plugin is loaded." \
        "Cargar el plugin Georoster."

# vim:ft=tcl:ts=8:sw=4:sts=4:et

Changes to georoster/msgs/nl.msg.

1
2
3
4
5
6
7
8
9

10

11


12


13
14
15
16
17


18
19



# nl.msg --
#
#	Dutch messages for the Georoster Tkabber plugin.
#
# Author: Sander Devrieze <s.devrieze@pandora.be>

::msgcat::mcset nl "Georoster" "Georoster"
::msgcat::mcset nl "Store" "Opslaan"
::msgcat::mcset nl "Latitude: %.2f  Longitude: %.2f" "Breedtegraad: %.2f  Lengtegraad: %.2f" 

::msgcat::mcset nl "Automatically open Georoster window." "Venster van Georoster automatisch openen."

::msgcat::mcset nl "Automatically look at vCard to find users coordinates." "Automatisch in vCard kijken om de coördinaten van gebruikers te vinden."


::msgcat::mcset nl "Display users who are no longer available." "Toon gebruikers die niet langer beschikbaar zijn."


::msgcat::mcset nl "Default country to use when looking at a vCard." "Standaard land dat gebruikt wordt tijdens het kijken naar een vCard."
::msgcat::mcset nl "Plugins options." "Pluginopties."
::msgcat::mcset nl "Georoster plugin options." "Pluginopties van Georoster."
::msgcat::mcset nl "Don't show cities" "Steden verbergen"
::msgcat::mcset nl "Show only city markers" "Enkel markeringen voor steden laten zien"


::msgcat::mcset nl "Show city markers and names" "Markeringen voor steden en stadsnamen laten zien"
::msgcat::mcset nl "Specify how to show cities at the map." "Geef op hoe steden op de map getoond moeten worden."





|





|
>
|
>
|
>
>
|
>
>
|



|
>
>
|
|
>
>
>
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
# nl.msg --
#
#       Dutch messages for the Georoster Tkabber plugin.
#
# Author: Sander Devrieze <s.devrieze@pandora.be>

::msgcat::mcset nl "Georoster" "Georoster"
::msgcat::mcset nl "Store" "Opslaan"
::msgcat::mcset nl "Latitude: %.2f  Longitude: %.2f" \
        "Breedtegraad: %.2f  Lengtegraad: %.2f" 
::msgcat::mcset nl "Automatically open Georoster window." \
        "Venster van Georoster automatisch openen."
::msgcat::mcset nl "Automatically look at vCard to find users coordinates." \
        "Automatisch in vCard kijken om de coördinaten van gebruikers te\
        vinden."
::msgcat::mcset nl "Display users who are no longer available." \
        "Toon gebruikers die niet langer beschikbaar zijn."
::msgcat::mcset nl "Default country to use when looking at a vCard." \
        "Standaard land dat gebruikt wordt tijdens het kijken naar een vCard."
::msgcat::mcset nl "Plugins options." "Pluginopties."
::msgcat::mcset nl "Georoster plugin options." "Pluginopties van Georoster."
::msgcat::mcset nl "Don't show cities" "Steden verbergen"
::msgcat::mcset nl "Show only city markers" \
        "Enkel markeringen voor steden laten zien"
::msgcat::mcset nl "Show city markers and names" \
        "Markeringen voor steden en stadsnamen laten zien"
::msgcat::mcset nl "Specify how to show cities at the map." \
        "Geef op hoe steden op de map getoond moeten worden."

# vim:ft=tcl:ts=8:sw=4:sts=4:et

Changes to georoster/msgs/pl.msg.

1
2
3
4
5
6
7
8

9

10

11

12
13

14
15
16
17

18

19
20
21



# pl.msg --
#
#	Polish messages for the Georoster Tkabber plugin.
#
# Author: Irek Chmielowiec <irek.ch@gmail.com>

::msgcat::mcset pl "Plugins options." "Ustawienia wtyczek."
::msgcat::mcset pl "Automatically open Georoster window." "Pokazuj automatycznie okno Georostera po uruchomieniu."

::msgcat::mcset pl "Default country to use when looking at a vCard." "Domyślnie używany kod kraju przy wyszukiwaniu w wizytówkach."

::msgcat::mcset pl "Automatically look at vCard to find users coordinates." "Automatycznie wyszukuj koordynaty geograficzne w wizytówkach."

::msgcat::mcset pl "Display users who are no longer available." "Pokazuj użytkowników niedostępnych."

::msgcat::mcset pl "Georoster" "Georoster"
::msgcat::mcset pl "Latitude: %.2f  Longitude: %.2f" "Szerokość: %.2f  Długość: %.2f"

::msgcat::mcset pl "Georoster plugin options." "Ustawienia wtyczki Georoster."
::msgcat::mcset pl "Don't show cities" "Nie pokazuj miast"
::msgcat::mcset pl "Show only city markers" "Pokaż miasta jako punkty"
::msgcat::mcset pl "Show city markers and names" "Pokaż miasta jako punkty z nazwami"

::msgcat::mcset pl "Specify how to show cities at the map." "Wybierz sposób prezentacji miast na mapie."

::msgcat::mcset pl "Store" "Zapisz"
::msgcat::mcset pl "Connection: %s" "Połączenie: %s"
::msgcat::mcset pl "Whether the Georoster plugin is loaded." "Załaduj wtyczkę Georoster."





|




|
>
|
>
|
>
|
>

|
>



|
>
|
>


|
>
>
>
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
# pl.msg --
#
#       Polish messages for the Georoster Tkabber plugin.
#
# Author: Irek Chmielowiec <irek.ch@gmail.com>

::msgcat::mcset pl "Plugins options." "Ustawienia wtyczek."
::msgcat::mcset pl "Automatically open Georoster window." \
        "Pokazuj automatycznie okno Georostera po uruchomieniu."
::msgcat::mcset pl "Default country to use when looking at a vCard." \
        "Domyślnie używany kod kraju przy wyszukiwaniu w wizytówkach."
::msgcat::mcset pl "Automatically look at vCard to find users coordinates." \
        "Automatycznie wyszukuj koordynaty geograficzne w wizytówkach."
::msgcat::mcset pl "Display users who are no longer available." \
        "Pokazuj użytkowników niedostępnych."
::msgcat::mcset pl "Georoster" "Georoster"
::msgcat::mcset pl "Latitude: %.2f  Longitude: %.2f" \
        "Szerokość: %.2f  Długość: %.2f"
::msgcat::mcset pl "Georoster plugin options." "Ustawienia wtyczki Georoster."
::msgcat::mcset pl "Don't show cities" "Nie pokazuj miast"
::msgcat::mcset pl "Show only city markers" "Pokaż miasta jako punkty"
::msgcat::mcset pl "Show city markers and names" \
        "Pokaż miasta jako punkty z nazwami"
::msgcat::mcset pl "Specify how to show cities at the map." \
        "Wybierz sposób prezentacji miast na mapie."
::msgcat::mcset pl "Store" "Zapisz"
::msgcat::mcset pl "Connection: %s" "Połączenie: %s"
::msgcat::mcset pl "Whether the Georoster plugin is loaded." \
        "Załaduj wtyczkę Georoster."

# vim:ft=tcl:ts=8:sw=4:sts=4:et

Changes to georoster/msgs/ro.msg.

1
2
3
4
5
6
7
8



# ro.msg --
#
#	Romanian messages for the Georoster Tkabber plugin.

::msgcat::mcset ro "Georoster" "Listă geografică"
::msgcat::mcset ro "Store" "Salvare"
::msgcat::mcset ro "Show cities" "Arată oraşe"
::msgcat::mcset ro "Latitude: %.2f  Longitude: %.2f" "Latitudine: %.2f  Longitudine: %.2f"





|




|
>
>
>
1
2
3
4
5
6
7
8
9
10
11
# ro.msg --
#
#       Romanian messages for the Georoster Tkabber plugin.

::msgcat::mcset ro "Georoster" "Listă geografică"
::msgcat::mcset ro "Store" "Salvare"
::msgcat::mcset ro "Show cities" "Arată oraşe"
::msgcat::mcset ro "Latitude: %.2f  Longitude: %.2f" \
        "Latitudine: %.2f  Longitudine: %.2f"

# vim:ft=tcl:ts=8:sw=4:sts=4:et

Changes to georoster/msgs/ru.msg.

1
2
3
4
5
6
7

8
9
10

11
12

13
14
15
16


17

18

19

20
21
22


# ru.msg --
#
#	Russian messages for the Georoster Tkabber plugin.
#
# Author: Sergei Golovan <sgolovan@nes.ru>

::msgcat::mcset ru "Plugins options." "Параметры расширений."

::msgcat::mcset ru "Georoster plugin options." "Параметры расширения Геоконтакты"
::msgcat::mcset ru "Don't show cities" "Не показывать города"
::msgcat::mcset ru "Show only city markers" "Показывать только метки городов"

::msgcat::mcset ru "Show city markers and names" "Показывать метки городов и названия"
::msgcat::mcset ru "Specify how to show cities at the map." "Как показывать города на карте."

::msgcat::mcset ru "Georoster" "Геоконтакты"
::msgcat::mcset ru "Connection: %s" "Соединение: %s"
::msgcat::mcset ru "Store" "Сохранить"
::msgcat::mcset ru "Latitude: %.2f  Longitude: %.2f" "Широта: %.2f  Долгота: %.2f"


::msgcat::mcset ru "Automatically open Georoster window." "Автоматически открывать окно Геоконтактов."

::msgcat::mcset ru "Automatically look at vCard to find users coordinates." "Автоматически искать координаты пользователей во vCard."

::msgcat::mcset ru "Display users who are no longer available." "Отображать недоступных пользователей."

::msgcat::mcset ru "Default country to use when looking at a vCard." "Страна, используемая по умолчанию (если не указана во vCard)."
::msgcat::mcset ru "Whether the Georoster plugin is loaded."\
	"Загружено ли расширение Геоконтакты."




|




>
|


>
|
|
>



|
>
>
|
>
|
>
|
>
|
|
|
>
>
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
# ru.msg --
#
#       Russian messages for the Georoster Tkabber plugin.
#
# Author: Sergei Golovan <sgolovan@nes.ru>

::msgcat::mcset ru "Plugins options." "Параметры расширений."
::msgcat::mcset ru "Georoster plugin options." \
        "Параметры расширения Геоконтакты"
::msgcat::mcset ru "Don't show cities" "Не показывать города"
::msgcat::mcset ru "Show only city markers" "Показывать только метки городов"
::msgcat::mcset ru "Show city markers and names" \
        "Показывать метки городов и названия"
::msgcat::mcset ru "Specify how to show cities at the map." \
        "Как показывать города на карте."
::msgcat::mcset ru "Georoster" "Геоконтакты"
::msgcat::mcset ru "Connection: %s" "Соединение: %s"
::msgcat::mcset ru "Store" "Сохранить"
::msgcat::mcset ru "Latitude: %.2f  Longitude: %.2f" \
        "Широта: %.2f  Долгота: %.2f"
::msgcat::mcset ru "Automatically open Georoster window." \
        "Автоматически открывать окно Геоконтактов."
::msgcat::mcset ru "Automatically look at vCard to find users coordinates." \
        "Автоматически искать координаты пользователей во vCard."
::msgcat::mcset ru "Display users who are no longer available." \
        "Отображать недоступных пользователей."
::msgcat::mcset ru "Default country to use when looking at a vCard." \
        "Страна, используемая по умолчанию (если не указана во vCard)."
::msgcat::mcset ru "Whether the Georoster plugin is loaded." \
        "Загружено ли расширение Геоконтакты."

# vim:ft=tcl:ts=8:sw=4:sts=4:et

Changes to georoster/msgs/uk.msg.

1
2
3
4
5
6
7
8
9
10

11
12

13
14
15
16


17

18

19

20


# uk.msg --
#
#	Ukrainian messages for the Georoster Tkabber plugin.
#
# Author: Artem Bondarenko

::msgcat::mcset uk "Plugins options." "Параметри плагінів."
::msgcat::mcset uk "Georoster plugin options." "Параметри плагіна Геоконтакти"
::msgcat::mcset uk "Don't show cities" "Не показувати міста"
::msgcat::mcset uk "Show only city markers" "Показувати тільки мітки міст"

::msgcat::mcset uk "Show city markers and names" "Показувати мітки міст і назви"
::msgcat::mcset uk "Specify how to show cities at the map." "Як показувати міста на карті."

::msgcat::mcset uk "Georoster" "Геоконтакти"
::msgcat::mcset uk "Connection: %s" "З'єднання: %s"
::msgcat::mcset uk "Store" "Зберегти"
::msgcat::mcset uk "Latitude: %.2f  Longitude: %.2f" "Широта: %.2f  Довгота: %.2f"


::msgcat::mcset uk "Automatically open Georoster window." "Автоматично відкривати вікно Геоконтактів."

::msgcat::mcset uk "Automatically look at vCard to find users coordinates." "Автоматично шукати координати користувачів у vCard."

::msgcat::mcset uk "Display users who are no longer available." "Відображати недоступних користувачів."

::msgcat::mcset uk "Default country to use when looking at a vCard." "Країна, використовувана за замовчуванням (якщо не зазначена в vCard)."




|







>
|
|
>



|
>
>
|
>
|
>
|
>
|
>
>
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
# uk.msg --
#
#       Ukrainian messages for the Georoster Tkabber plugin.
#
# Author: Artem Bondarenko

::msgcat::mcset uk "Plugins options." "Параметри плагінів."
::msgcat::mcset uk "Georoster plugin options." "Параметри плагіна Геоконтакти"
::msgcat::mcset uk "Don't show cities" "Не показувати міста"
::msgcat::mcset uk "Show only city markers" "Показувати тільки мітки міст"
::msgcat::mcset uk "Show city markers and names" \
        "Показувати мітки міст і назви"
::msgcat::mcset uk "Specify how to show cities at the map." \
        "Як показувати міста на карті."
::msgcat::mcset uk "Georoster" "Геоконтакти"
::msgcat::mcset uk "Connection: %s" "З'єднання: %s"
::msgcat::mcset uk "Store" "Зберегти"
::msgcat::mcset uk "Latitude: %.2f  Longitude: %.2f" \
        "Широта: %.2f  Довгота: %.2f"
::msgcat::mcset uk "Automatically open Georoster window." \
        "Автоматично відкривати вікно Геоконтактів."
::msgcat::mcset uk "Automatically look at vCard to find users coordinates." \
        "Автоматично шукати координати користувачів у vCard."
::msgcat::mcset uk "Display users who are no longer available." \
        "Відображати недоступних користувачів."
::msgcat::mcset uk "Default country to use when looking at a vCard." \
        "Країна, використовувана за замовчуванням (якщо не зазначена в vCard)."

# vim:ft=tcl:ts=8:sw=4:sts=4:et