rwdaddresses 1.01 → 1.02

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/Readme.txt +5 -0
  2. data/code/01rwdcore/01rwdcore.rb +15 -13
  3. data/code/01rwdcore/openhelpwindow.rb +26 -26
  4. data/code/01rwdcore/returntomain.rb +8 -8
  5. data/code/01rwdcore/rwdtinkerversion.rb +12 -13
  6. data/code/01rwdcore/rwdwindowreturn.rb +3 -5
  7. data/code/01rwdcore/test_cases.rb +115 -0
  8. data/code/01rwdcore/test_harness.rb +12 -0
  9. data/code/01rwdcore/uploadreturns.rb +60 -59
  10. data/code/superant.com.rwdaddresses/attachtmpcontactphoto.rb +23 -23
  11. data/code/superant.com.rwdaddresses/clearscreendisplay.rb +14 -15
  12. data/code/superant.com.rwdaddresses/createnewnamerecord.rb +19 -18
  13. data/code/superant.com.rwdaddresses/deletecontactrecord.rb +22 -21
  14. data/code/superant.com.rwdaddresses/deleterwdaddressesupdatefiles.rb +15 -16
  15. data/code/superant.com.rwdaddresses/downloadrwdaddressfiles.rb +34 -32
  16. data/code/superant.com.rwdaddresses/listnamerecord.rb +14 -14
  17. data/code/superant.com.rwdaddresses/listvcardrecord.rb +15 -0
  18. data/code/superant.com.rwdaddresses/loadconfigurationrecord.rb +45 -44
  19. data/code/superant.com.rwdaddresses/loadconfigurationvariables.rb +14 -13
  20. data/code/superant.com.rwdaddresses/loadnamerecord.rb +29 -29
  21. data/code/superant.com.rwdaddresses/openhelpwindowrwdaddresses.rb +25 -25
  22. data/code/superant.com.rwdaddresses/renamecontact.rb +14 -15
  23. data/code/superant.com.rwdaddresses/returntomain.rb +8 -8
  24. data/code/superant.com.rwdaddresses/runaddresseswindow.rb +8 -8
  25. data/code/superant.com.rwdaddresses/runrwdaddressesmenu1.rb +31 -31
  26. data/code/superant.com.rwdaddresses/runrwdaddresssyncbackwindow.rb +8 -8
  27. data/code/superant.com.rwdaddresses/rwdaddressesbackwindow.rb +8 -8
  28. data/code/superant.com.rwdaddresses/rwdaddresseshelpabout.rb +10 -11
  29. data/code/superant.com.rwdaddresses/saveconfigurationrecord.rb +20 -20
  30. data/code/superant.com.rwdaddresses/savevcardrecord.rb +76 -0
  31. data/code/superant.com.rwdaddresses/syncrwdaddress.rb +24 -26
  32. data/code/superant.com.rwdaddresses/uploadrwdaddressfiles.rb +28 -28
  33. data/code/superant.com.rwdaddresses/viewaddressconfiguration.rb +21 -21
  34. data/code/superant.com.rwdaddresses/viewnamedata.rb +27 -26
  35. data/code/superant.com.rwdaddresses/viewphoto.rb +4 -4
  36. data/code/superant.com.rwdaddresses/viewrwdaddressesconfiguration.rb +23 -21
  37. data/code/superant.com.rwdaddresses/viewtmpcontactphoto.rb +6 -6
  38. data/code/superant.com.rwdaddresses/viewvcarddata.rb +22 -0
  39. data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +89 -92
  40. data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +15 -20
  41. data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +19 -18
  42. data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -19
  43. data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -18
  44. data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +7 -7
  45. data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +48 -49
  46. data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +8 -7
  47. data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -26
  48. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -31
  49. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -13
  50. data/code/superant.com.rwdtinkerbackwindow/network.rb +82 -82
  51. data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -17
  52. data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +37 -37
  53. data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +20 -20
  54. data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +33 -32
  55. data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +8 -9
  56. data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +10 -11
  57. data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -18
  58. data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -20
  59. data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +23 -20
  60. data/configuration/language.dist +1 -1
  61. data/configuration/rwdaddresses.dist +2 -2
  62. data/configuration/rwdtinker.dist +2 -2
  63. data/configuration/tinkerwin2variables.dist +1 -1
  64. data/extras/vpim/date.rb +198 -0
  65. data/extras/vpim/dirinfo.rb +229 -0
  66. data/extras/vpim/enumerator.rb +29 -0
  67. data/extras/vpim/field.rb +497 -0
  68. data/extras/vpim/maker/vcard.rb +312 -0
  69. data/extras/vpim/rfc2425.rb +244 -0
  70. data/extras/vpim/rrule.rb +482 -0
  71. data/extras/vpim/time.rb +42 -0
  72. data/extras/vpim/vcard.rb +151 -0
  73. data/extras/vpim/vpim.rb +94 -0
  74. data/gui/frontwindow0/superant.com.rwdaddresses/16editrecord.rwd +5 -0
  75. data/gui/frontwindow0/superant.com.rwdaddresses/17viewvcardrecord.rwd +32 -0
  76. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
  77. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/70rwddiagnostics.rwd +1 -11
  78. data/init.rb +231 -228
  79. data/names/Angelina Jolie.vcf +8 -0
  80. data/rwd_files/HowTo_Addresses.txt +5 -0
  81. data/rwd_files/HowTo_Tinker.txt +14 -0
  82. data/rwdconfig.dist +6 -2
  83. data/tests/makedist.rb +36 -7
  84. metadata +23 -21
  85. data/extras/cmdline_parse +0 -47
  86. data/extras/config_file +0 -69
  87. data/extras/errorMsg +0 -19
  88. data/extras/makePlaylist +0 -34
  89. data/extras/mp3controld +0 -289
  90. data/extras/playlist +0 -186
  91. data/extras/plugins/Network +0 -237
  92. data/extras/showHelp +0 -18
  93. data/gui/frontwindowselections/superant.com.rwdaddressesselectiontab/rwdaddressessyncselectiontab.rwd +0 -12
  94. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +0 -4
  95. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +0 -3
  96. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +0 -10
  97. data/installed/rwdaddressesdata2.inf +0 -8
  98. 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
- require 'fileutils'
3
- @rwdaddressessyncresult = ""
4
- begin
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
- rescue
26
-
6
+ @rwdaddressessyncresult = "updating local files" + "\n"
7
+ Dir.chdir($progdir)
27
8
 
28
- print "sync error"
29
- end
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
- 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
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
- 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
+ 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
- def viewnamedata
2
- require 'fileutils'
3
- $currentnametext = "%s" % [@a_viewnamedata]
4
- photoname = $currentnametext + ".jpg"
5
- begin # exception trapped block
6
- path_to = File.join( "rwd_files", "contacttmp.jpg" )
7
- path_from = File.join($addressfiles_directory, photoname )
8
- if ! File.exist?(path_from)
9
- path_from = File.join($addressfiles_directory,"nophoto.jpg" )
10
- end
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
- end
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
- def viewcontactphoto
2
- @rwd_window = "contactphoto"
3
-
4
- end
1
+ def viewcontactphoto
2
+ @rwd_window = "contactphoto"
3
+ end
4
+
@@ -1,21 +1,23 @@
1
- def viewrwdaddressesconfiguration
2
- require 'fileutils'
3
- begin # exception trapped block
4
-
5
- Dir.chdir($progdir)
6
- rwdaddressesconfigurationfile = File.join( "configuration", "rwdaddresses.cnf" )
7
- if File.exist?(rwdaddressesconfigurationfile)
8
- fd = File.open(rwdaddressesconfigurationfile,"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
+ #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
- fileList = Dir.new($tmpphoto_directory).entries.sort.delete_if { |x| ! (x =~ /jpg$/) }
4
- @listnamerecordfilesresult = ""
5
- @listphotosfromtmp = fileList.rwd_method("filltmpcontactphoto")
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
- applet = inffile.gsub(/\.nam$/, "")
10
- @a_tmpphotoname = applet
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
- ip = '127.0.0.1'
8
- # And this one...
9
- port = $rwdcontrolport1
10
- if @a_remoteportinput
11
- port = @a_remoteportinput.to_i
12
- end
13
-
14
- commandtext = @a_remotecommandinput.to_s
15
- remotehostnotfound = true
16
- if (commandtext == "stop")
17
- begin
18
- client = UDPSocket::new()
19
- client.send(commandtext, 0, ip, port)
20
- @socket = UDPSocket::new()
21
- @socket.bind(ip, port)
22
- # Rescue the "Address in use" error
23
- rescue Errno::EADDRINUSE
24
-
25
- databack, info = client.recv(128)
26
- @remotecommandresult = databack
27
- @lastremotecommand = "rwdtinker remote:: Port #{port} on host #{ip} ."
28
- remotehostnotfound = false
29
-
30
- # Rescue the "Address not available" error
31
- rescue Errno::EADDRNOTAVAIL
32
- puts "Network plugin: Address #{host} is not available to bind."
33
-
34
- # Rescue "permission denied errors
35
- rescue Errno::EACCES
36
- puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
37
-
38
- # Rescue all other errors
39
- rescue
40
- puts "Network plugin: An error occured."
41
-
42
- # Rescue all other errors
43
- end
44
- if remotehostnotfound
45
- @remotecommandresult = "Remote Host not running"
46
- end
47
- @socket.close
48
- # Close the socket after use
49
- client.close()
50
- end
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
- if remotehostnotfound
88
- @remotecommandresult = "Remote Host not running"
89
- end
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
- @remoteportoptions = $rwdcontrolports.rwd_options
96
- @remotecommandoptions = ["query","stop"].rwd_options
97
- end
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.erikveen.dds.nl/rubywebdialogs/index.html
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
- require 'resolv'
10
- require 'date'
11
-
12
- # return the platform information
13
- def runviewplatform
14
- @platformdisplay = "Platform is " + RUBY_PLATFORM + "\n"
15
- @platformdisplay = @platformdisplay + "Ruby Version " + VERSION + "\n"
16
- @platformdisplay = @platformdisplay + "rwdtinker version " + RwdTinkerVersion + "\n"
17
- @platformdisplay = @platformdisplay + "program directory " + $progdir + "\n"
18
- @platformdisplay = @platformdisplay + "hostname " + Resolv.getname(Resolv.getaddress("localhost")) + "\n"
19
- @platformdisplay = @platformdisplay + "Date " + Date.today().to_s
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
- def installapplet
3
-
4
- nametext = "%s" % [@a_installapplet]
2
+ def installapplet
5
3
 
6
- begin # exception trapped block
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
- 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
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