Ruby GTK3移行後のメインリポジトリ
リビジョン | 8d8391d00f95fa8ea979381f6b80b5c8658eeb1d (tree) |
---|---|
日時 | 2015-03-28 21:15:25 |
作者 | Shyouzou Sugitani <shy@user...> |
コミッター | Shyouzou Sugitani |
assorted fixes
@@ -87,7 +87,7 @@ module Alias | ||
87 | 87 | table[key] = [] |
88 | 88 | for value in values[1, values.length - 2].split(',') |
89 | 89 | begin |
90 | - value = str(int(value)) | |
90 | + value = value.to_i.to_s | |
91 | 91 | rescue |
92 | 92 | #except ValueError: |
93 | 93 | #pass |
@@ -1862,7 +1862,7 @@ module Balloon | ||
1862 | 1862 | def show(default) |
1863 | 1863 | if default != nil |
1864 | 1864 | begin |
1865 | - text = str(default) | |
1865 | + text = default.to_s | |
1866 | 1866 | rescue # except: |
1867 | 1867 | text = '' |
1868 | 1868 | end |
@@ -23,7 +23,7 @@ module NConfig | ||
23 | 23 | keylist = [name] |
24 | 24 | end |
25 | 25 | for key in keylist |
26 | - if self.has_key?(key) | |
26 | + if has_key?(key) | |
27 | 27 | return self[key] |
28 | 28 | end |
29 | 29 | end |
@@ -428,13 +428,13 @@ module Install | ||
428 | 428 | filelist << [thumbnail_pnr, |
429 | 429 | File.join(prefix, 'thumbnail.pnr')] |
430 | 430 | end |
431 | - for path in self.list_all_files(ghost_src, '') | |
431 | + for path in list_all_files(ghost_src, '') | |
432 | 432 | filelist << [File.join(ghost_src, path), |
433 | 433 | File.join(ghost_dst, path)] |
434 | 434 | end |
435 | 435 | ghost_name = inst.get('name') |
436 | 436 | # find shell |
437 | - for path in self.list_all_files(shell_src, '') | |
437 | + for path in list_all_files(shell_src, '') | |
438 | 438 | filelist << [File.join(shell_src, path), |
439 | 439 | File.join(shell_dst, path)] |
440 | 440 | end |
@@ -544,7 +544,7 @@ module Install | ||
544 | 544 | #logging.info('not found') |
545 | 545 | return nil, nil, 4 |
546 | 546 | else |
547 | - target = self.select(candidates) | |
547 | + target = select(candidates) | |
548 | 548 | if target == nil |
549 | 549 | return nil, nil, 4 |
550 | 550 | end |
@@ -289,7 +289,7 @@ module Kinoko | ||
289 | 289 | @__shown = false |
290 | 290 | @surface_id = 0 # dummy |
291 | 291 | @window = Pix::TransparentWindow.new() |
292 | - ##self.window.set_title(''.join(('surface.', name))) | |
292 | + ##@window.set_title(['surface.', name].join('')) | |
293 | 293 | @window.set_skip_taskbar_hint(true) |
294 | 294 | @window.signal_connect('delete_event') do |w, e| |
295 | 295 | delete(w, e) |
@@ -487,7 +487,7 @@ module Kinoko | ||
487 | 487 | if File.exists?(path) |
488 | 488 | @path = path |
489 | 489 | else |
490 | - #self.path = None | |
490 | + #path = nil | |
491 | 491 | @path = File.join(@data['dir'], @data['base']) |
492 | 492 | end |
493 | 493 | end |
@@ -916,7 +916,7 @@ module NGM | ||
916 | 916 | |
917 | 917 | def install_current |
918 | 918 | begin |
919 | - filetype, target_dir = @installer.install(self.get('ArchiveUrl'), | |
919 | + filetype, target_dir = @installer.install(get('ArchiveUrl'), | |
920 | 920 | Home.get_ninix_home()) |
921 | 921 | rescue #except: |
922 | 922 | target_dir = nil |
@@ -928,7 +928,7 @@ module NGM | ||
928 | 928 | end |
929 | 929 | |
930 | 930 | def update_current ## FIXME |
931 | - @parent.handle_request('NOTIFY', 'update_sakura', self.get('Name'), 'NGM') | |
931 | + @parent.handle_request('NOTIFY', 'update_sakura', get('Name'), 'NGM') | |
932 | 932 | end |
933 | 933 | end |
934 | 934 | end |
@@ -15,6 +15,7 @@ | ||
15 | 15 | |
16 | 16 | require "gtk3" |
17 | 17 | require "gst" |
18 | +require "cgi" | |
18 | 19 | |
19 | 20 | require "ninix/surface" |
20 | 21 | require "ninix/balloon" |
@@ -78,12 +79,6 @@ module Sakura | ||
78 | 79 | # script origins |
79 | 80 | FROM_SSTP_CLIENT = 1 |
80 | 81 | FROM_GHOST = 2 |
81 | - # HTML entity definitions | |
82 | - begin | |
83 | - from html.entities import name2codepoint | |
84 | - rescue # except: | |
85 | - name2codepoint = nil | |
86 | - end | |
87 | 82 | |
88 | 83 | def initialize |
89 | 84 | @parent = nil |
@@ -215,7 +210,7 @@ module Sakura | ||
215 | 210 | def notify_installedshellname() |
216 | 211 | installed = [] |
217 | 212 | for key in @shells |
218 | - installed.append(@shells[key].baseinfo[0]) | |
213 | + installed << @shells[key].baseinfo[0] | |
219 | 214 | end |
220 | 215 | notify_event('installedshellname', *installed) |
221 | 216 | end |
@@ -317,21 +312,21 @@ module Sakura | ||
317 | 312 | f = open(path, 'r') |
318 | 313 | for line in f |
319 | 314 | if not line.include?(',') |
320 | - continue | |
315 | + next | |
321 | 316 | end |
322 | 317 | key, value = line.split(',', 1) |
323 | 318 | key = key.strip() |
324 | 319 | if key == 'time' |
325 | 320 | begin |
326 | - ghost_time = int(value.strip()) | |
321 | + ghost_time = value.strip().to_i | |
327 | 322 | rescue #except: |
328 | - pass | |
323 | + #pass | |
329 | 324 | end |
330 | 325 | elsif key == 'vanished_count' |
331 | 326 | begin |
332 | - ghost_vanished_count = int(value.strip()) | |
327 | + ghost_vanished_count = value.strip().to_i | |
333 | 328 | rescue #except: |
334 | - pass | |
329 | + #pass | |
335 | 330 | end |
336 | 331 | end |
337 | 332 | end |
@@ -356,7 +351,7 @@ module Sakura | ||
356 | 351 | f = open(path, 'r') |
357 | 352 | for line in f |
358 | 353 | if not line.include?(',') |
359 | - continue | |
354 | + next | |
360 | 355 | end |
361 | 356 | key, value = line.split(',', 1) |
362 | 357 | if key.strip() == 'balloon_directory' |
@@ -510,9 +505,9 @@ module Sakura | ||
510 | 505 | end |
511 | 506 | reset_script(1) |
512 | 507 | end |
513 | - @script_queue.append([event, script, sender, handle, host, | |
514 | - show_sstp_marker, use_translator, | |
515 | - db, request_handler]) | |
508 | + @script_queue << [event, script, sender, handle, host, | |
509 | + show_sstp_marker, use_translator, | |
510 | + db, request_handler] | |
516 | 511 | end |
517 | 512 | |
518 | 513 | reset_event = ['OnGhostChanging', 'OnShellChanging', 'OnVanishSelected'] |
@@ -528,7 +523,7 @@ module Sakura | ||
528 | 523 | if @reset_event.include?(event) |
529 | 524 | reset_script(1) |
530 | 525 | end |
531 | - @event_queue.append([event, arglist, argdict]) | |
526 | + @event_queue << [event, arglist, argdict] | |
532 | 527 | end |
533 | 528 | |
534 | 529 | EVENT_SCRIPTS = { |
@@ -553,7 +548,7 @@ module Sakura | ||
553 | 548 | argdict = {'default' => EVENT_SCRIPTS.get(event)} |
554 | 549 | if notify_event(event, *arglist, **argdict) |
555 | 550 | if proc != nil |
556 | - @script_post_proc.append(proc) | |
551 | + @script_post_proc << proc | |
557 | 552 | end |
558 | 553 | return 1 |
559 | 554 | elsif proc != nil |
@@ -785,10 +780,10 @@ module Sakura | ||
785 | 780 | for line in response.splitlines() |
786 | 781 | line = str(line, @__charset, 'ignore').strip() |
787 | 782 | if not line |
788 | - continue | |
783 | + next | |
789 | 784 | end |
790 | 785 | if not line.include?(':') |
791 | - continue | |
786 | + next | |
792 | 787 | end |
793 | 788 | key, value = line.split(':', 1) |
794 | 789 | key = key.strip() |
@@ -839,9 +834,9 @@ module Sakura | ||
839 | 834 | value = ref[i] |
840 | 835 | if value != nil |
841 | 836 | value = value if isinstance(value, str) \ |
842 | - else str(value) | |
837 | + else value.to_s | |
843 | 838 | header = ''.join([header, |
844 | - 'Reference', str(i), ': ', | |
839 | + 'Reference', i.to_s, ': ', | |
845 | 840 | value, '\r\n']) |
846 | 841 | end |
847 | 842 | end |
@@ -950,7 +945,7 @@ module Sakura | ||
950 | 945 | notify_event('OnBoot', @surface.name, default=default) |
951 | 946 | end |
952 | 947 | else |
953 | - pass ## FIXME | |
948 | + #pass ## FIXME | |
954 | 949 | end |
955 | 950 | end |
956 | 951 |
@@ -1219,7 +1214,7 @@ module Sakura | ||
1219 | 1214 | value = arglist[n] |
1220 | 1215 | if value != nil |
1221 | 1216 | value = value if isinstance(value, str) \ |
1222 | - else str(value) | |
1217 | + else value.to_s | |
1223 | 1218 | logging.debug( |
1224 | 1219 | 'Reference{0:d}: {1}'.format(n, value)) |
1225 | 1220 | end |
@@ -1274,7 +1269,7 @@ module Sakura | ||
1274 | 1269 | start_script(script) |
1275 | 1270 | @balloon.hide_sstp_message() |
1276 | 1271 | if @boot_event.include?(event) |
1277 | - @script_finally.append(@surface_bootup) | |
1272 | + @script_finally << @surface_bootup | |
1278 | 1273 | end |
1279 | 1274 | def proc(flag_break=false) |
1280 | 1275 | @parent.handle_request( |
@@ -1285,7 +1280,7 @@ module Sakura | ||
1285 | 1280 | flag_break, communication, |
1286 | 1281 | nil, false, script, arglist) |
1287 | 1282 | end |
1288 | - @script_finally.append(proc) | |
1283 | + @script_finally << proc | |
1289 | 1284 | return 1 |
1290 | 1285 | end |
1291 | 1286 |
@@ -1374,11 +1369,11 @@ module Sakura | ||
1374 | 1369 | color_g = getstring('menu.background.font.color.g') |
1375 | 1370 | color_b = getstring('menu.background.font.color.b') |
1376 | 1371 | begin |
1377 | - color_r = max(0, min(255, int(color_r))) | |
1378 | - color_g = max(0, min(255, int(color_g))) | |
1379 | - color_b = max(0, min(255, int(color_b))) | |
1372 | + color_r = max(0, min(255, color_r.to_i)) | |
1373 | + color_g = max(0, min(255, color_g.to_i)) | |
1374 | + color_b = max(0, min(255, color_b.to_i)) | |
1380 | 1375 | rescue #except: |
1381 | - pass | |
1376 | + #pass | |
1382 | 1377 | else |
1383 | 1378 | background = [color_r, color_g, color_b] |
1384 | 1379 | end |
@@ -1386,11 +1381,11 @@ module Sakura | ||
1386 | 1381 | color_g = getstring('menu.foreground.font.color.g') |
1387 | 1382 | color_b = getstring('menu.foreground.font.color.b') |
1388 | 1383 | begin |
1389 | - color_r = max(0, min(255, int(color_r))) | |
1390 | - color_g = max(0, min(255, int(color_g))) | |
1391 | - color_b = max(0, min(255, int(color_b))) | |
1384 | + color_r = max(0, min(255, color_r.to_i)) | |
1385 | + color_g = max(0, min(255, color_g.to_i)) | |
1386 | + color_b = max(0, min(255, color_b.to_i)) | |
1392 | 1387 | rescue #except: |
1393 | - pass | |
1388 | + #pass | |
1394 | 1389 | else |
1395 | 1390 | foreground = [color_r, color_g, color_b] |
1396 | 1391 | end |
@@ -1469,7 +1464,7 @@ module Sakura | ||
1469 | 1464 | end |
1470 | 1465 | |
1471 | 1466 | def get_uptime() |
1472 | - uptime = (int(time.time() - @start_time) / 3600).to_i | |
1467 | + uptime = ((time.time() - @start_time).to_i / 3600).to_i | |
1473 | 1468 | if uptime < 0 |
1474 | 1469 | @start_time = time.time() |
1475 | 1470 | return 0 |
@@ -1745,13 +1740,13 @@ module Sakura | ||
1745 | 1740 | @old_otherghostname = otherghostname |
1746 | 1741 | end |
1747 | 1742 | if not @__running |
1748 | - pass | |
1743 | + #pass | |
1749 | 1744 | elsif [PAUSE_MODE, PAUSE_NOCLEAR_MODE].include?(@script_mode) |
1750 | 1745 | ##if idle > PAUSE_TIMEOUT: |
1751 | 1746 | ## @script_mode = BROWSE_MODE |
1752 | - pass | |
1747 | + #pass | |
1753 | 1748 | elsif @script_mode == WAIT_MODE |
1754 | - pass | |
1749 | + #pass | |
1755 | 1750 | elsif @processed_script or @processed_text |
1756 | 1751 | interpret_script() |
1757 | 1752 | elsif @script_post_proc |
@@ -1766,7 +1761,7 @@ module Sakura | ||
1766 | 1761 | @script_finally = [] |
1767 | 1762 | elsif @script_mode == SELECT_MODE |
1768 | 1763 | if @passivemode |
1769 | - pass | |
1764 | + #pass | |
1770 | 1765 | elsif idle > SELECT_TIMEOUT |
1771 | 1766 | @script_mode = BROWSE_MODE |
1772 | 1767 | if @sstp_request_handler |
@@ -1780,7 +1775,7 @@ module Sakura | ||
1780 | 1775 | elsif @sstp_handle != nil |
1781 | 1776 | close_sstp_handle() |
1782 | 1777 | elsif @balloon.user_interaction |
1783 | - pass | |
1778 | + #pass | |
1784 | 1779 | elsif idle > @__balloon_life > 0 and not @passivemode |
1785 | 1780 | @__balloon_life = 0 |
1786 | 1781 | for side in range(@char) |
@@ -1795,7 +1790,7 @@ module Sakura | ||
1795 | 1790 | @surface.lower_all() |
1796 | 1791 | end |
1797 | 1792 | elsif @event_queue and handle_event() |
1798 | - pass | |
1793 | + #pass | |
1799 | 1794 | elsif @script_queue and not @passivemode |
1800 | 1795 | if get_silent_time() > 0 |
1801 | 1796 | keep_silence(true) # extend silent time |
@@ -1821,7 +1816,7 @@ module Sakura | ||
1821 | 1816 | flag_break, nil, |
1822 | 1817 | [sender, host], (not use_translator), script, []) |
1823 | 1818 | end |
1824 | - @script_finally.append(proc) | |
1819 | + @script_finally << proc | |
1825 | 1820 | end |
1826 | 1821 | elsif get_silent_time() > 0 |
1827 | 1822 | if now - get_silent_time() > SILENT_TIME |
@@ -1832,13 +1827,13 @@ module Sakura | ||
1832 | 1827 | @surface.get_mikire(), |
1833 | 1828 | @surface.get_kasanari(), |
1834 | 1829 | (not @passivemode and @cantalk)) |
1835 | - pass | |
1830 | + #pass | |
1836 | 1831 | elsif @clock[1] != minute and \ |
1837 | 1832 | notify_event('OnMinuteChange', get_uptime(), |
1838 | 1833 | @surface.get_mikire(), |
1839 | 1834 | @surface.get_kasanari(), |
1840 | 1835 | (not @passivemode and @cantalk)) |
1841 | - pass | |
1836 | + #pass | |
1842 | 1837 | elsif @surface_mouse_motion != nil |
1843 | 1838 | side, x, y, part = @surface_mouse_motion |
1844 | 1839 | notify_event('OnMouseMove', x, y, '', side, part) |
@@ -1992,7 +1987,7 @@ module Sakura | ||
1992 | 1987 | |
1993 | 1988 | def __yen_p(args) |
1994 | 1989 | begin |
1995 | - chr_id = int(args[0]) | |
1990 | + chr_id = args[0].to_i | |
1996 | 1991 | rescue #except: |
1997 | 1992 | return |
1998 | 1993 | end |
@@ -2082,7 +2077,7 @@ module Sakura | ||
2082 | 2077 | @balloon.hide(@script_side) |
2083 | 2078 | else |
2084 | 2079 | begin |
2085 | - balloon_id = (int(args[0]) / 2).to_i | |
2080 | + balloon_id = (args[0].to_i / 2).to_i | |
2086 | 2081 | rescue #except ValueError: |
2087 | 2082 | balloon_id = 0 |
2088 | 2083 | else |
@@ -2125,7 +2120,7 @@ module Sakura | ||
2125 | 2120 | |
2126 | 2121 | def __set_weight(value, unit) |
2127 | 2122 | begin |
2128 | - amount = int(value) * unit - 0.01 | |
2123 | + amount = value.to_i * unit - 0.01 | |
2129 | 2124 | rescue #except ValueError: |
2130 | 2125 | amount = 0 |
2131 | 2126 | end |
@@ -2161,7 +2156,7 @@ module Sakura | ||
2161 | 2156 | def __yen__s(args) |
2162 | 2157 | list = [] |
2163 | 2158 | for arg in args |
2164 | - list.append(int(arg)) | |
2159 | + list << arg.to_i | |
2165 | 2160 | end |
2166 | 2161 | set_synchronized_session(list) |
2167 | 2162 | end |
@@ -2230,9 +2225,9 @@ module Sakura | ||
2230 | 2225 | |
2231 | 2226 | def __yen_i(args) |
2232 | 2227 | begin |
2233 | - actor_id = int(args[0]) | |
2228 | + actor_id = args[0].to_i | |
2234 | 2229 | rescue #except ValueError: |
2235 | - pass | |
2230 | + #pass | |
2236 | 2231 | else |
2237 | 2232 | @surface.invoke(@script_side, actor_id) |
2238 | 2233 | end |
@@ -2264,13 +2259,9 @@ module Sakura | ||
2264 | 2259 | end |
2265 | 2260 | |
2266 | 2261 | def __yen_and(args) |
2267 | - if @name2codepoint != nil | |
2268 | - begin | |
2269 | - text = chr(@name2codepoint.get(args[0])) | |
2270 | - rescue #except: | |
2271 | - text = nil | |
2272 | - end | |
2273 | - else | |
2262 | + begin | |
2263 | + text = CGI.unescape_html("&" + args[0].to_s +";") | |
2264 | + rescue #except: | |
2274 | 2265 | text = nil |
2275 | 2266 | end |
2276 | 2267 | if text == nil |
@@ -2281,7 +2272,7 @@ module Sakura | ||
2281 | 2272 | |
2282 | 2273 | def __yen__m(args) |
2283 | 2274 | begin |
2284 | - num = int(args[0], 16) | |
2275 | + num = args[0].to_i(16) | |
2285 | 2276 | rescue #except ValueError: |
2286 | 2277 | num = 0 |
2287 | 2278 | end |
@@ -2356,7 +2347,7 @@ module Sakura | ||
2356 | 2347 | argc = len(args) |
2357 | 2348 | args = [] |
2358 | 2349 | for s in args |
2359 | - args.append(expand_meta(s)) | |
2350 | + args << expand_meta(s) | |
2360 | 2351 | end |
2361 | 2352 | if args[0] == 'raise' and argc >= 2 |
2362 | 2353 | notify_event(*args[1, 9]) |
@@ -2486,7 +2477,7 @@ module Sakura | ||
2486 | 2477 | elsif args[2] == 'enable' |
2487 | 2478 | @balloon.set_autoscroll(true) |
2488 | 2479 | else |
2489 | - pass ## FIXME | |
2480 | + #pass ## FIXME | |
2490 | 2481 | end |
2491 | 2482 | elsif args[0, 2] == ['set', 'windowstate'] and argc > 2 |
2492 | 2483 | if args[2] == 'minimize' |
@@ -2544,7 +2535,7 @@ module Sakura | ||
2544 | 2535 | ''.join(['file://', path])) |
2545 | 2536 | gsettings.set_string('picture-options', opt) |
2546 | 2537 | else |
2547 | - pass # not implemented yet | |
2538 | + #pass # not implemented yet | |
2548 | 2539 | end |
2549 | 2540 | end |
2550 | 2541 | elsif args[0, 2] == ['set', 'otherghosttalk'] and argc > 2 |
@@ -2553,7 +2544,7 @@ module Sakura | ||
2553 | 2544 | elsif args[2] == 'false' |
2554 | 2545 | @__listening['OnOtherGhostTalk'] = false |
2555 | 2546 | else |
2556 | - pass ## FIXME | |
2547 | + #pass ## FIXME | |
2557 | 2548 | end |
2558 | 2549 | elsif args[0, 2] == ['set', 'othersurfacechange'] and argc > 2 |
2559 | 2550 | if args[2] == 'true' |
@@ -2561,14 +2552,14 @@ module Sakura | ||
2561 | 2552 | elsif args[2] == 'false' |
2562 | 2553 | @__listening['OnOtherSurfaceChange'] = false |
2563 | 2554 | else |
2564 | - pass ## FIXME | |
2555 | + #pass ## FIXME | |
2565 | 2556 | end |
2566 | 2557 | elsif args[0, 2] == ['set', 'balloonoffset'] and argc > 3 |
2567 | 2558 | begin |
2568 | - x = int(args[2]) | |
2569 | - y = int(args[3]) | |
2559 | + x = args[2].to_i | |
2560 | + y = args[3].to_i | |
2570 | 2561 | rescue #except: |
2571 | - pass | |
2562 | + #pass | |
2572 | 2563 | else |
2573 | 2564 | @surface.set_balloon_offset(@script_side, [x, y]) |
2574 | 2565 | end |
@@ -2595,7 +2586,7 @@ module Sakura | ||
2595 | 2586 | elsif command == 'cdplay' and argc > 2 |
2596 | 2587 | @audio_player.set_state(Gst::State::NULL) |
2597 | 2588 | begin |
2598 | - track = int(args[2]) | |
2589 | + track = args[2].to_i | |
2599 | 2590 | rescue #except: |
2600 | 2591 | return |
2601 | 2592 | end |
@@ -2631,7 +2622,7 @@ module Sakura | ||
2631 | 2622 | @audio_player.set_state(Gst::State::PLAYING) |
2632 | 2623 | end |
2633 | 2624 | else |
2634 | - pass ## FIXME | |
2625 | + #pass ## FIXME | |
2635 | 2626 | end |
2636 | 2627 | elsif args[0] == '*' |
2637 | 2628 | @balloon.append_sstp_marker(@script_side) |
@@ -2641,7 +2632,7 @@ module Sakura | ||
2641 | 2632 | elsif args[1] == 'false' |
2642 | 2633 | @quick_session = 0 |
2643 | 2634 | else |
2644 | - pass ## FIXME | |
2635 | + #pass ## FIXME | |
2645 | 2636 | end |
2646 | 2637 | elsif args[0] == 'bind' and argc > 2 |
2647 | 2638 | category = args[1] |
@@ -2655,26 +2646,26 @@ module Sakura | ||
2655 | 2646 | for key in bind |
2656 | 2647 | group = bind[key][0].split(',') |
2657 | 2648 | if category != group[0] |
2658 | - continue | |
2649 | + next | |
2659 | 2650 | end |
2660 | 2651 | if name and name != group[1] |
2661 | - continue | |
2652 | + next | |
2662 | 2653 | end |
2663 | 2654 | if ['true', '1'].include?(flag) |
2664 | 2655 | if bind[key][1] |
2665 | - continue | |
2656 | + next | |
2666 | 2657 | end |
2667 | 2658 | elsif ['false', '0'].include?(flag) |
2668 | 2659 | if not bind[key][1] |
2669 | - continue | |
2660 | + next | |
2670 | 2661 | end |
2671 | 2662 | else # 'toggle' |
2672 | - pass | |
2663 | + #pass | |
2673 | 2664 | end |
2674 | 2665 | @surface.toggle_bind([@script_side, key]) |
2675 | 2666 | end |
2676 | 2667 | else |
2677 | - pass ## FIXME | |
2668 | + #pass ## FIXME | |
2678 | 2669 | end |
2679 | 2670 | end |
2680 | 2671 |
@@ -2720,7 +2711,7 @@ module Sakura | ||
2720 | 2711 | tag = '</u>' |
2721 | 2712 | end |
2722 | 2713 | else |
2723 | - pass ## FIXME | |
2714 | + #pass ## FIXME | |
2724 | 2715 | end |
2725 | 2716 | if tag != nil |
2726 | 2717 | @balloon.append_meta(@script_side, tag) |
@@ -2804,7 +2795,7 @@ module Sakura | ||
2804 | 2795 | if @__script_tag.include?(name) |
2805 | 2796 | @__script_tag[name].call(self, args) |
2806 | 2797 | else |
2807 | - pass ## FIMXE | |
2798 | + #pass ## FIMXE | |
2808 | 2799 | end |
2809 | 2800 | elsif node[0] == ninix.script.SCRIPT_TEXT |
2810 | 2801 | text = expand_meta(node[1]) |
@@ -2863,48 +2854,47 @@ module Sakura | ||
2863 | 2854 | buf = [] |
2864 | 2855 | for chunk in text_node |
2865 | 2856 | if chunk[0] == ninix.script.TEXT_STRING |
2866 | - buf.append(chunk[1]) | |
2857 | + buf << chunk[1] | |
2867 | 2858 | elsif chunk[1] == '%month' |
2868 | - buf.append(str(@current_time[1])) | |
2859 | + buf << @current_time[1].to_s | |
2869 | 2860 | elsif chunk[1] == '%day' |
2870 | - buf.append(str(@current_time[2])) | |
2861 | + buf << @current_time[2].to_s | |
2871 | 2862 | elsif chunk[1] == '%hour' |
2872 | - buf.append(str(@current_time[3])) | |
2863 | + buf << @current_time[3].to_s | |
2873 | 2864 | elsif chunk[1] == '%minute' |
2874 | - buf.append(str(@current_time[4])) | |
2865 | + buf << @current_time[4].to_s | |
2875 | 2866 | elsif chunk[1] == '%second' |
2876 | - buf.append(str(@current_time[5])) | |
2867 | + buf << @current_time[5].to_s | |
2877 | 2868 | elsif ['%username', '%c'].include?(chunk[1]) |
2878 | - buf.append(get_username()) | |
2869 | + buf << get_username() | |
2879 | 2870 | elsif chunk[1] == '%selfname' |
2880 | - buf.append(get_selfname()) | |
2871 | + buf << get_selfname() | |
2881 | 2872 | elsif chunk[1] == '%selfname2' |
2882 | - buf.append(get_selfname2()) | |
2873 | + buf << get_selfname2() | |
2883 | 2874 | elsif chunk[1] == '%keroname' |
2884 | - buf.append(get_keroname()) | |
2875 | + buf << get_keroname() | |
2885 | 2876 | elsif chunk[1] == '%friendname' |
2886 | - buf.append(get_friendname()) | |
2877 | + buf << get_friendname() | |
2887 | 2878 | elsif chunk[1] == '%screenwidth' |
2888 | 2879 | left, top, scrn_w, scrn_h = ninix.pix.get_workarea() |
2889 | - buf.append(str(scrn_w)) | |
2880 | + buf << scrn_w.to_s | |
2890 | 2881 | elsif chunk[1] == '%screenheight' |
2891 | 2882 | left, top, scrn_w, scrn_h = ninix.pix.get_workarea() |
2892 | - buf.append(str(scrn_h)) | |
2883 | + buf << scrn_h.to_s | |
2893 | 2884 | elsif chunk[1] == '%et' |
2894 | - buf.append('{0:d}万年'.format(@current_time[7])) | |
2885 | + buf << '{0:d}万年'.format(@current_time[7]) | |
2895 | 2886 | elsif chunk[1] == '%wronghour' |
2896 | 2887 | wrongtime = time.time() + random.choice([-2, -1, 1, 2]) * 3600 |
2897 | - buf.append(str(time.localtime(wrongtime)[3])) | |
2888 | + buf << time.localtime(wrongtime)[3].to_s | |
2898 | 2889 | elsif chunk[1] == '%exh' |
2899 | - buf.append(str(get_uptime())) | |
2890 | + buf << get_uptime().to_s | |
2900 | 2891 | elsif ['%ms', '%mz', '%ml', '%mc', '%mh', \ |
2901 | 2892 | '%mt', '%me', '%mp', '%m?'].include?(chunk[1]) |
2902 | - buf.append( | |
2903 | - getword(''.join(['\\', chunk[1][1..-1]]))) | |
2893 | + buf << getword(''.join(['\\', chunk[1][1..-1]])) | |
2904 | 2894 | elsif chunk[1] == '%dms' |
2905 | - buf.append(getdms()) | |
2895 | + buf << getdms() | |
2906 | 2896 | else # %c, %songname |
2907 | - buf.append(chunk[1]) | |
2897 | + buf << chunk[1] | |
2908 | 2898 | end |
2909 | 2899 | end |
2910 | 2900 | return ''.join(buf) |
@@ -2919,7 +2909,7 @@ module Sakura | ||
2919 | 2909 | begin |
2920 | 2910 | @sstp_handle.send(''.join([data, '\n'])) |
2921 | 2911 | rescue #except socket.error: |
2922 | - pass | |
2912 | + #pass | |
2923 | 2913 | end |
2924 | 2914 | end |
2925 | 2915 |
@@ -2940,7 +2930,7 @@ module Sakura | ||
2940 | 2930 | begin |
2941 | 2931 | @sstp_handle.close() |
2942 | 2932 | rescue #except socket.error |
2943 | - pass | |
2933 | + #pass | |
2944 | 2934 | end |
2945 | 2935 | @sstp_handle = nil |
2946 | 2936 | end |
@@ -21,7 +21,6 @@ module SSTPLib | ||
21 | 21 | |
22 | 22 | def initialize(hostname="", port) |
23 | 23 | super(hostname, port) |
24 | - #allow_reuse_address = True | |
25 | 24 | setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true) |
26 | 25 | end |
27 | 26 | end |
@@ -29,7 +28,7 @@ module SSTPLib | ||
29 | 28 | class AsynchronousSSTPServer < SSTPServer |
30 | 29 | |
31 | 30 | def handle_request |
32 | - r, w, e = select.select([self.socket], [], [], 0) | |
31 | + r, w, e = select.select([@socket], [], [], 0) | |
33 | 32 | if not r |
34 | 33 | return |
35 | 34 | end |
@@ -226,7 +226,7 @@ module Update | ||
226 | 226 | return |
227 | 227 | elsif @state == 2 # updates2.dau |
228 | 228 | enqueue_event( |
229 | - 'OnUpdateFailure', str(code), 'updates2.dau', '', | |
229 | + 'OnUpdateFailure', code.to_s, 'updates2.dau', '', | |
230 | 230 | 'ghost') # XXX |
231 | 231 | @state = nil |
232 | 232 | return |