rwdaddresses 1.01 → 1.02
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.txt +5 -0
- data/code/01rwdcore/01rwdcore.rb +15 -13
- data/code/01rwdcore/openhelpwindow.rb +26 -26
- data/code/01rwdcore/returntomain.rb +8 -8
- data/code/01rwdcore/rwdtinkerversion.rb +12 -13
- data/code/01rwdcore/rwdwindowreturn.rb +3 -5
- data/code/01rwdcore/test_cases.rb +115 -0
- data/code/01rwdcore/test_harness.rb +12 -0
- data/code/01rwdcore/uploadreturns.rb +60 -59
- data/code/superant.com.rwdaddresses/attachtmpcontactphoto.rb +23 -23
- data/code/superant.com.rwdaddresses/clearscreendisplay.rb +14 -15
- data/code/superant.com.rwdaddresses/createnewnamerecord.rb +19 -18
- data/code/superant.com.rwdaddresses/deletecontactrecord.rb +22 -21
- data/code/superant.com.rwdaddresses/deleterwdaddressesupdatefiles.rb +15 -16
- data/code/superant.com.rwdaddresses/downloadrwdaddressfiles.rb +34 -32
- data/code/superant.com.rwdaddresses/listnamerecord.rb +14 -14
- data/code/superant.com.rwdaddresses/listvcardrecord.rb +15 -0
- data/code/superant.com.rwdaddresses/loadconfigurationrecord.rb +45 -44
- data/code/superant.com.rwdaddresses/loadconfigurationvariables.rb +14 -13
- data/code/superant.com.rwdaddresses/loadnamerecord.rb +29 -29
- data/code/superant.com.rwdaddresses/openhelpwindowrwdaddresses.rb +25 -25
- data/code/superant.com.rwdaddresses/renamecontact.rb +14 -15
- data/code/superant.com.rwdaddresses/returntomain.rb +8 -8
- data/code/superant.com.rwdaddresses/runaddresseswindow.rb +8 -8
- data/code/superant.com.rwdaddresses/runrwdaddressesmenu1.rb +31 -31
- data/code/superant.com.rwdaddresses/runrwdaddresssyncbackwindow.rb +8 -8
- data/code/superant.com.rwdaddresses/rwdaddressesbackwindow.rb +8 -8
- data/code/superant.com.rwdaddresses/rwdaddresseshelpabout.rb +10 -11
- data/code/superant.com.rwdaddresses/saveconfigurationrecord.rb +20 -20
- data/code/superant.com.rwdaddresses/savevcardrecord.rb +76 -0
- data/code/superant.com.rwdaddresses/syncrwdaddress.rb +24 -26
- data/code/superant.com.rwdaddresses/uploadrwdaddressfiles.rb +28 -28
- data/code/superant.com.rwdaddresses/viewaddressconfiguration.rb +21 -21
- data/code/superant.com.rwdaddresses/viewnamedata.rb +27 -26
- data/code/superant.com.rwdaddresses/viewphoto.rb +4 -4
- data/code/superant.com.rwdaddresses/viewrwdaddressesconfiguration.rb +23 -21
- data/code/superant.com.rwdaddresses/viewtmpcontactphoto.rb +6 -6
- data/code/superant.com.rwdaddresses/viewvcarddata.rb +22 -0
- data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +89 -92
- data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +15 -20
- data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -19
- data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +7 -7
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +48 -49
- data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +8 -7
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -26
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -31
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -13
- data/code/superant.com.rwdtinkerbackwindow/network.rb +82 -82
- data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -17
- data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +37 -37
- data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +20 -20
- data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +33 -32
- data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +8 -9
- data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +10 -11
- data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -20
- data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +23 -20
- data/configuration/language.dist +1 -1
- data/configuration/rwdaddresses.dist +2 -2
- data/configuration/rwdtinker.dist +2 -2
- data/configuration/tinkerwin2variables.dist +1 -1
- data/extras/vpim/date.rb +198 -0
- data/extras/vpim/dirinfo.rb +229 -0
- data/extras/vpim/enumerator.rb +29 -0
- data/extras/vpim/field.rb +497 -0
- data/extras/vpim/maker/vcard.rb +312 -0
- data/extras/vpim/rfc2425.rb +244 -0
- data/extras/vpim/rrule.rb +482 -0
- data/extras/vpim/time.rb +42 -0
- data/extras/vpim/vcard.rb +151 -0
- data/extras/vpim/vpim.rb +94 -0
- data/gui/frontwindow0/superant.com.rwdaddresses/16editrecord.rwd +5 -0
- data/gui/frontwindow0/superant.com.rwdaddresses/17viewvcardrecord.rwd +32 -0
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/70rwddiagnostics.rwd +1 -11
- data/init.rb +231 -228
- data/names/Angelina Jolie.vcf +8 -0
- data/rwd_files/HowTo_Addresses.txt +5 -0
- data/rwd_files/HowTo_Tinker.txt +14 -0
- data/rwdconfig.dist +6 -2
- data/tests/makedist.rb +36 -7
- metadata +23 -21
- data/extras/cmdline_parse +0 -47
- data/extras/config_file +0 -69
- data/extras/errorMsg +0 -19
- data/extras/makePlaylist +0 -34
- data/extras/mp3controld +0 -289
- data/extras/playlist +0 -186
- data/extras/plugins/Network +0 -237
- data/extras/showHelp +0 -18
- data/gui/frontwindowselections/superant.com.rwdaddressesselectiontab/rwdaddressessyncselectiontab.rwd +0 -12
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +0 -4
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +0 -3
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +0 -10
- data/installed/rwdaddressesdata2.inf +0 -8
- data/rwd_files/tinker.png +0 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
# this method adds a new record
|
2
|
+
def savevcardrecord
|
3
|
+
Dir.chdir($progdir)
|
4
|
+
require 'fileutils'
|
5
|
+
require 'extras/vpim/maker/vcard'
|
6
|
+
if ! @a_filename.empty?
|
7
|
+
newname = "%s" % [@a_filename] # grab the new filename to create
|
8
|
+
|
9
|
+
fullnewname = newname + ".vcf"
|
10
|
+
if ! @a_name.empty?
|
11
|
+
contactnameText = @a_name.to_s
|
12
|
+
else
|
13
|
+
contactnameText = @a_filename.to_s
|
14
|
+
end
|
15
|
+
card = Vpim::Maker::Vcard.make(contactnameText) do |card|
|
16
|
+
card.add_name do |name|
|
17
|
+
name.family = contactnameText
|
18
|
+
|
19
|
+
end
|
20
|
+
if ! @a_address.empty?
|
21
|
+
addressText = @a_address.to_s
|
22
|
+
else
|
23
|
+
addressText = " "
|
24
|
+
end
|
25
|
+
if ! @a_citystatezip.empty?
|
26
|
+
localityText = @a_citystatezip.to_s
|
27
|
+
else
|
28
|
+
localityText = " "
|
29
|
+
end
|
30
|
+
|
31
|
+
card.add_addr do |addr|
|
32
|
+
addr.preferred = true
|
33
|
+
addr.location = 'home'
|
34
|
+
addr.street = addressText
|
35
|
+
addr.locality = localityText
|
36
|
+
addr.country = 'rwdaddress'
|
37
|
+
end
|
38
|
+
if ! @a_phone.empty?
|
39
|
+
phoneText = @a_phone.to_s
|
40
|
+
else
|
41
|
+
phoneText = " "
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
card.add_tel(phoneText) do |tel|
|
46
|
+
tel.location = 'home'
|
47
|
+
|
48
|
+
end
|
49
|
+
if ! @a_email.empty?
|
50
|
+
emailText = @a_email.to_s
|
51
|
+
else
|
52
|
+
emailText = " "
|
53
|
+
end
|
54
|
+
|
55
|
+
card.add_email(emailText) { |e| e.location = 'home' }
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
end # end of vcard creation
|
61
|
+
|
62
|
+
end
|
63
|
+
vCardString = card.to_s
|
64
|
+
p vCardString
|
65
|
+
|
66
|
+
begin # exception trapped block
|
67
|
+
fileName = File.join($addressfiles_directory, fullnewname )
|
68
|
+
fd = File.open(fileName,"w")
|
69
|
+
fd.print( vCardString ) # save the record info to the file
|
70
|
+
fd.close
|
71
|
+
@createnewnamerecorddisplay= vCardString # show the record info in the browser
|
72
|
+
rescue SystemCallError, StandardError
|
73
|
+
$stderr.print "system call error: " + $!
|
74
|
+
end # exception rescue
|
75
|
+
|
76
|
+
end
|
@@ -1,30 +1,28 @@
|
|
1
1
|
def syncrwdaddressdata
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
@rwdaddressessyncresult = "updating local files" + "\n"
|
7
|
-
Dir.chdir($progdir)
|
8
|
-
|
9
|
-
localfileListarray = Dir.new($addressfiles_directory).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /nam$/) }
|
10
|
-
remotefileListarray = Dir.new($rwdaddresses_updatedirectory ).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /nam$/) }
|
11
|
-
|
12
|
-
tempupdatefilelistarray = remotefileListarray - localfileListarray
|
13
|
-
|
14
|
-
if tempupdatefilelistarray
|
15
|
-
tempupdatefilelistarray.each do |temp|
|
16
|
-
tmpfilenametosync = File.join($rwdaddresses_updatedirectory,temp)
|
17
|
-
tmpfilenamecopied = File.join($addressfiles_directory,temp)
|
18
|
-
FileUtils.cp( tmpfilenametosync, tmpfilenamecopied)
|
19
|
-
@rwdaddressessyncresult = @rwdaddressessyncresult + temp + "\n"
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
2
|
+
require 'fileutils'
|
3
|
+
@rwdaddressessyncresult = ""
|
4
|
+
begin
|
23
5
|
|
24
|
-
|
25
|
-
|
26
|
-
|
6
|
+
@rwdaddressessyncresult = "updating local files" + "\n"
|
7
|
+
Dir.chdir($progdir)
|
27
8
|
|
28
|
-
|
29
|
-
|
9
|
+
localfileListarray = Dir.new($addressfiles_directory).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /nam$/) }
|
10
|
+
remotefileListarray = Dir.new($rwdaddresses_updatedirectory ).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /nam$/) }
|
11
|
+
|
12
|
+
tempupdatefilelistarray = remotefileListarray - localfileListarray
|
13
|
+
|
14
|
+
if tempupdatefilelistarray
|
15
|
+
tempupdatefilelistarray.each do |temp|
|
16
|
+
tmpfilenametosync = File.join($rwdaddresses_updatedirectory,temp)
|
17
|
+
tmpfilenamecopied = File.join($addressfiles_directory,temp)
|
18
|
+
FileUtils.cp( tmpfilenametosync, tmpfilenamecopied)
|
19
|
+
@rwdaddressessyncresult = @rwdaddressessyncresult + temp + "\n"
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
rescue
|
26
|
+
print "sync error"
|
27
|
+
end
|
30
28
|
end
|
@@ -1,30 +1,30 @@
|
|
1
1
|
def uploadrwdaddressfiles
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@rwdaddressesftpdisplay = "files uploaded" + "\n"
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rescue
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
print "ftp error"
|
29
|
-
end
|
2
|
+
require 'net/ftp'
|
3
|
+
BasicSocket.do_not_reverse_lookup = true
|
4
|
+
@rwdaddressftpdisplays = ""
|
5
|
+
begin
|
6
|
+
ftp = Net::FTP::new($rwdaddresses_ftpsite)
|
7
|
+
@rwdaddressesftpdisplay = "files uploaded" + "\n"
|
8
|
+
|
9
|
+
fileListarray = Dir.new($addressfiles_directory).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /nam$/) }
|
10
|
+
if fileListarray
|
11
|
+
ftp.debug_mode = false
|
12
|
+
ftp.login($rwdaddresses_ftplogin, $rwdaddresses_ftppassword)
|
13
|
+
ftp.chdir($rwdaddresses_ftpdirectory)
|
14
|
+
print "I'm in the directory ", ftp.pwd(), "\n"
|
15
|
+
fileListarray.each do |temp|
|
16
|
+
tmpfilenametoupload = File.join($addressfiles_directory,temp)
|
17
|
+
ftp.puttextfile(tmpfilenametoupload , temp)
|
18
|
+
@rwdaddressesftpdisplay = @rwdaddressesftpdisplay + temp + "\n"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
ftp.close
|
22
|
+
|
23
|
+
rescue
|
24
|
+
|
25
|
+
if ftp
|
26
|
+
ftp.close
|
27
|
+
end
|
28
|
+
print "ftp error"
|
29
|
+
end
|
30
30
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
def viewaddressesconfiguration
|
2
|
+
require 'fileutils'
|
3
|
+
begin # exception trapped block
|
4
|
+
|
5
|
+
Dir.chdir($progdir)
|
6
|
+
rwdaddrssesconfigurationfile = File.join( "configuration", "rwdaddresses.cnf" )
|
7
|
+
if File.exist?(rwdaddrssesconfigurationfile)
|
8
|
+
fd = File.open(rwdaddrssesconfigurationfile,"r")
|
9
|
+
@rwdaddressesconfigurationtext = " "
|
10
|
+
while ! fd.eof?
|
11
|
+
@rwdaddressesconfigurationtext = fd.read
|
12
|
+
end
|
13
|
+
fd.close
|
14
|
+
else
|
15
|
+
@rwdaddressesconfigurationtext = "File error"
|
16
|
+
end
|
17
|
+
rescue SystemCallError, StandardError
|
18
|
+
$stderr.print "system call error: " + $!
|
19
|
+
@rwdaddressesconfigurationtext = "File error"
|
20
|
+
end # exception rescue
|
21
|
+
end
|
@@ -1,27 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Dir.chdir($progdir)
|
13
|
-
FileUtils.cp(path_from, path_to)
|
14
|
-
sleep $photodelay
|
15
|
-
fileName = $addressfiles_directory + "/" + $currentnametext + ".nam"
|
16
|
-
|
17
|
-
fd = File.open(fileName,"r")
|
18
|
-
@viewnamedatadisplay = " "
|
19
|
-
while ! fd.eof?
|
20
|
-
@viewnamedatadisplay = fd.read
|
21
|
-
end
|
22
|
-
fd.close
|
23
|
-
rescue SystemCallError, StandardError
|
24
|
-
$stderr.print "system call error: " + $!
|
25
|
-
end # exception rescue
|
1
|
+
#view name
|
2
|
+
def viewnamedata
|
3
|
+
require 'fileutils'
|
4
|
+
$currentnametext = "%s" % [@a_viewnamedata]
|
5
|
+
photoname = $currentnametext + ".jpg"
|
6
|
+
begin # exception trapped block
|
7
|
+
path_to = File.join( "rwd_files", "contacttmp.jpg" )
|
8
|
+
path_from = File.join($addressfiles_directory, photoname )
|
9
|
+
if ! File.exist?(path_from)
|
10
|
+
path_from = File.join($addressfiles_directory,"nophoto.jpg" )
|
11
|
+
end
|
26
12
|
|
27
|
-
|
13
|
+
Dir.chdir($progdir)
|
14
|
+
FileUtils.cp(path_from, path_to)
|
15
|
+
sleep $photodelay
|
16
|
+
fileName = $addressfiles_directory + "/" + $currentnametext + ".nam"
|
17
|
+
|
18
|
+
fd = File.open(fileName,"r")
|
19
|
+
@viewnamedatadisplay = " "
|
20
|
+
while ! fd.eof?
|
21
|
+
@viewnamedatadisplay = fd.read
|
22
|
+
end
|
23
|
+
fd.close
|
24
|
+
rescue SystemCallError, StandardError
|
25
|
+
$stderr.print "system call error: " + $!
|
26
|
+
end # exception rescue
|
27
|
+
|
28
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
def viewcontactphoto
|
2
|
+
@rwd_window = "contactphoto"
|
3
|
+
end
|
4
|
+
|
@@ -1,21 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
#view configuration
|
2
|
+
def viewrwdaddressesconfiguration
|
3
|
+
require 'fileutils'
|
4
|
+
begin # exception trapped block
|
5
|
+
|
6
|
+
Dir.chdir($progdir)
|
7
|
+
rwdaddressesconfigurationfile = File.join( "configuration", "rwdaddresses.cnf" )
|
8
|
+
if File.exist?(rwdaddressesconfigurationfile)
|
9
|
+
fd = File.open(rwdaddressesconfigurationfile,"r")
|
10
|
+
@rwdaddressesconfigurationtext = " "
|
11
|
+
while ! fd.eof?
|
12
|
+
@rwdaddressesconfigurationtext = fd.read
|
13
|
+
end
|
14
|
+
fd.close
|
15
|
+
else
|
16
|
+
@rwdaddressesconfigurationtext = "File error"
|
17
|
+
end
|
18
|
+
rescue SystemCallError, StandardError
|
19
|
+
$stderr.print "system call error: " + $!
|
20
|
+
@rwdaddressesconfigurationtext = "File error"
|
21
|
+
end # exception rescue
|
22
|
+
end
|
23
|
+
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# this code is to list the photo names
|
2
2
|
def viewtmpcontactphoto
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
fileList = Dir.new($tmpphoto_directory).entries.sort.delete_if { |x| ! (x =~ /jpg$/) }
|
4
|
+
@listnamerecordfilesresult = ""
|
5
|
+
@listphotosfromtmp = fileList.rwd_method("filltmpcontactphoto")
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def filltmpcontactphoto(inffile)
|
9
|
-
|
10
|
-
|
9
|
+
applet = inffile.gsub(/\.nam$/, "")
|
10
|
+
@a_tmpphotoname = applet
|
11
11
|
end
|
12
12
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#view name
|
2
|
+
def viewvcarddata
|
3
|
+
require 'fileutils'
|
4
|
+
$currentnametext = "%s" % [@a_viewvcarddata]
|
5
|
+
|
6
|
+
begin # exception trapped block
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
fileName = $addressfiles_directory + "/" + $currentnametext + ".vcf"
|
11
|
+
|
12
|
+
fd = File.open(fileName,"r")
|
13
|
+
@viewvcarddatadisplay = " "
|
14
|
+
while ! fd.eof?
|
15
|
+
@viewvcarddatadisplay = fd.read
|
16
|
+
end
|
17
|
+
fd.close
|
18
|
+
rescue SystemCallError, StandardError
|
19
|
+
$stderr.print "system call error: " + $!
|
20
|
+
end # exception rescue
|
21
|
+
|
22
|
+
end
|
@@ -1,99 +1,96 @@
|
|
1
1
|
# Bind message passing socket to rwdtinker application
|
2
|
-
|
3
2
|
def runcontrolcommand
|
4
|
-
require 'socket'
|
5
|
-
|
6
|
-
# Change this line...
|
7
|
-
|
8
|
-
# And this one...
|
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
|
-
# Rescue all other errors
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
remotehostnotfound = true
|
53
|
-
if (commandtext == "query")
|
54
|
-
begin
|
55
|
-
client = UDPSocket::new()
|
56
|
-
client.send(commandtext, 0, ip, port)
|
57
|
-
@socket = UDPSocket::new()
|
58
|
-
@socket.bind(ip, port)
|
59
|
-
# Rescue the "Address in use" error
|
60
|
-
rescue Errno::EADDRINUSE
|
61
|
-
|
62
|
-
databack, info = client.recv(128)
|
63
|
-
@remotecommandresult = databack
|
64
|
-
@lastremotecommand = "rwdtinker remote: Port #{port} on host #{ip} "
|
65
|
-
remotehostnotfound = false
|
66
|
-
|
67
|
-
# Rescue the "Address not available' error
|
68
|
-
rescue Errno::EADDRNOTAVAIL
|
69
|
-
puts "Network plugin: Address #{host} is not available to bind."
|
70
|
-
|
71
|
-
# Rescue "permission denied errors
|
72
|
-
rescue Errno::EACCES
|
73
|
-
puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
|
74
|
-
|
75
|
-
# Rescue all other errors
|
76
|
-
rescue
|
77
|
-
puts "Network plugin: An error occured."
|
78
|
-
|
79
|
-
# Rescue all other errors
|
80
|
-
end
|
81
|
-
@socket.close
|
82
|
-
|
83
|
-
# Close the socket after use
|
84
|
-
client.close()
|
85
|
-
end
|
3
|
+
require 'socket'
|
4
|
+
|
5
|
+
# Change this line...
|
6
|
+
ip = '127.0.0.1'
|
7
|
+
# And this one...
|
8
|
+
port = $rwdcontrolport1
|
9
|
+
if @a_remoteportinput
|
10
|
+
port = @a_remoteportinput.to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
commandtext = @a_remotecommandinput.to_s
|
14
|
+
remotehostnotfound = true
|
15
|
+
if (commandtext == "stop")
|
16
|
+
begin
|
17
|
+
client = UDPSocket::new()
|
18
|
+
client.send(commandtext, 0, ip, port)
|
19
|
+
@socket = UDPSocket::new()
|
20
|
+
@socket.bind(ip, port)
|
21
|
+
# Rescue the "Address in use" error
|
22
|
+
rescue Errno::EADDRINUSE
|
23
|
+
|
24
|
+
databack, info = client.recv(128)
|
25
|
+
@remotecommandresult = databack
|
26
|
+
@lastremotecommand = "rwdtinker remote:: Port #{port} on host #{ip} ."
|
27
|
+
remotehostnotfound = false
|
28
|
+
|
29
|
+
# Rescue the "Address not available" error
|
30
|
+
rescue Errno::EADDRNOTAVAIL
|
31
|
+
puts "Network plugin: Address #{host} is not available to bind."
|
32
|
+
|
33
|
+
# Rescue "permission denied errors
|
34
|
+
rescue Errno::EACCES
|
35
|
+
puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
|
36
|
+
|
37
|
+
# Rescue all other errors
|
38
|
+
rescue
|
39
|
+
puts "Network plugin: An error occured."
|
40
|
+
|
41
|
+
# Rescue all other errors
|
42
|
+
end
|
43
|
+
if remotehostnotfound
|
44
|
+
@remotecommandresult = "Remote Host not running"
|
45
|
+
end
|
46
|
+
@socket.close
|
47
|
+
# Close the socket after use
|
48
|
+
client.close()
|
49
|
+
end
|
86
50
|
|
87
|
-
|
88
|
-
|
89
|
-
|
51
|
+
remotehostnotfound = true
|
52
|
+
if (commandtext == "query")
|
53
|
+
begin
|
54
|
+
client = UDPSocket::new()
|
55
|
+
client.send(commandtext, 0, ip, port)
|
56
|
+
@socket = UDPSocket::new()
|
57
|
+
@socket.bind(ip, port)
|
58
|
+
# Rescue the "Address in use" error
|
59
|
+
rescue Errno::EADDRINUSE
|
60
|
+
|
61
|
+
databack, info = client.recv(128)
|
62
|
+
@remotecommandresult = databack
|
63
|
+
@lastremotecommand = "rwdtinker remote: Port #{port} on host #{ip} "
|
64
|
+
remotehostnotfound = false
|
65
|
+
|
66
|
+
# Rescue the "Address not available' error
|
67
|
+
rescue Errno::EADDRNOTAVAIL
|
68
|
+
puts "Network plugin: Address #{host} is not available to bind."
|
69
|
+
|
70
|
+
# Rescue "permission denied errors
|
71
|
+
rescue Errno::EACCES
|
72
|
+
puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
|
73
|
+
|
74
|
+
# Rescue all other errors
|
75
|
+
rescue
|
76
|
+
puts "Network plugin: An error occured."
|
77
|
+
|
78
|
+
# Rescue all other errors
|
79
|
+
end
|
80
|
+
@socket.close
|
81
|
+
|
82
|
+
# Close the socket after use
|
83
|
+
client.close()
|
84
|
+
end
|
85
|
+
|
86
|
+
if remotehostnotfound
|
87
|
+
@remotecommandresult = "Remote Host not running"
|
88
|
+
end
|
90
89
|
end
|
91
90
|
|
92
91
|
# list the remote control options on the screen
|
93
92
|
def showremoteportoptions
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
93
|
+
|
94
|
+
@remoteportoptions = $rwdcontrolports.rwd_options
|
95
|
+
@remotecommandoptions = ["query","stop"].rwd_options
|
96
|
+
end
|
@@ -1,24 +1,19 @@
|
|
1
1
|
# Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
|
2
2
|
# This application is a framework for writing programs from RubyWebDialogs
|
3
|
-
# http://www.
|
4
|
-
# For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
|
5
|
-
|
3
|
+
# For information see http://www.rubyforge.net/projects/rwdapplications
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
5
|
+
require 'resolv'
|
6
|
+
require 'date'
|
7
|
+
|
8
|
+
# return the platform information
|
9
|
+
def runviewplatform
|
10
|
+
@platformdisplay = "Platform is " + RUBY_PLATFORM + "\n"
|
11
|
+
@platformdisplay = @platformdisplay + "Ruby Version " + VERSION + "\n"
|
12
|
+
@platformdisplay = @platformdisplay + "rwdtinker version " + RwdTinkerVersion + "\n"
|
13
|
+
@platformdisplay = @platformdisplay + "program directory " + $progdir + "\n"
|
14
|
+
@platformdisplay = @platformdisplay + "hostname " + Resolv.getname(Resolv.getaddress("localhost")) + "\n"
|
15
|
+
@platformdisplay = @platformdisplay + "application name " + $rwdapplicationidentity + "\n"
|
16
|
+
@platformdisplay = @platformdisplay + "Date " + Date.today().to_s
|
17
|
+
|
18
|
+
end
|
23
19
|
|
24
|
-
|
@@ -1,24 +1,25 @@
|
|
1
1
|
# code in install rwdtinker applets - now uses ruby.zip module
|
2
|
-
|
3
|
-
|
4
|
-
nametext = "%s" % [@a_installapplet]
|
2
|
+
def installapplet
|
5
3
|
|
6
|
-
|
4
|
+
nametext = "%s" % [@a_installapplet]
|
7
5
|
|
6
|
+
begin # exception trapped block
|
8
7
|
|
9
|
-
require 'extras/zip/zip'
|
10
|
-
fullname = nametext + ".zip"
|
11
|
-
fileName = File.join($zipslocation,fullname)
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
9
|
+
require 'extras/zip/zip'
|
10
|
+
fullname = nametext + ".zip"
|
11
|
+
fileName = File.join($zipslocation,fullname)
|
12
|
+
|
13
|
+
zf = Zip::ZipFile.new(fileName)
|
14
|
+
zf.sort.each {
|
15
|
+
|entry|
|
16
|
+
zf.extract(entry.to_s, entry.to_s)
|
17
|
+
}
|
18
|
+
@installapplettext = Message[:applet_installed]
|
19
|
+
|
20
|
+
rescue
|
21
|
+
@installapplettext = "unzip error - applet may not be installed correctly"
|
22
|
+
end # exception rescue
|
23
|
+
|
24
|
+
end
|
23
25
|
|
24
|
-
end
|