dango_generator 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ package org.rubyforge.dango {
14
14
 
15
15
  private var dango_client:DangoClientFramework;
16
16
  public var all_sid_list:Array = []; //接続しているクライアントのsidの一覧
17
+ public var sid:int;
17
18
 
18
19
  /**
19
20
  * DangoAS3Mode
@@ -33,6 +34,8 @@ package org.rubyforge.dango {
33
34
  trace(error.message);
34
35
  }
35
36
 
37
+ this.sid = dango_client.sid;
38
+
36
39
  // エラー時のイベントリスナー
37
40
  dango_client.addEventListener("DangoError", connection_error);
38
41
 
@@ -68,6 +71,7 @@ package org.rubyforge.dango {
68
71
  * @return Array
69
72
  */
70
73
  private function dango__connect(evt:DangoReceiveEvent):void {
74
+ this.sid = dango_client.sid;
71
75
  this.dispatchEvent(new DangoAS3ModeReceiveEvent("dango__connect", {}));
72
76
  }
73
77
 
@@ -155,10 +155,24 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
155
155
 
156
156
  function AC_AddExtension(src, ext)
157
157
  {
158
- if (src.indexOf('?') != -1)
159
- return src.replace(/\?/, ext+'?');
158
+ var qIndex = src.indexOf('?');
159
+ if ( qIndex != -1)
160
+ {
161
+ // Add the extention (if needed) before the query params
162
+ var path = src.substring(0, qIndex);
163
+ if (path.length >= ext.length && path.lastIndexOf(ext) == (path.length - ext.length))
164
+ return src;
165
+ else
166
+ return src.replace(/\?/, ext+'?');
167
+ }
160
168
  else
161
- return src + ext;
169
+ {
170
+ // Add the extension (if needed) to the end of the URL
171
+ if (src.length >= ext.length && src.lastIndexOf(ext) == (src.length - ext.length))
172
+ return src; // Already have extension
173
+ else
174
+ return src + ext;
175
+ }
162
176
  }
163
177
 
164
178
  function AC_Generateobj(objAttrs, params, embedAttrs)
@@ -33,11 +33,11 @@ body { margin: 0px; overflow:hidden }
33
33
  // -----------------------------------------------------------------------------
34
34
  // Globals
35
35
  // Major version of Flash required
36
- var requiredMajorVersion = 9;
36
+ var requiredMajorVersion = 10;
37
37
  // Minor version of Flash required
38
38
  var requiredMinorVersion = 0;
39
39
  // Minor version of Flash required
40
- var requiredRevision = 124;
40
+ var requiredRevision = 2;
41
41
  // -----------------------------------------------------------------------------
42
42
  // -->
43
43
  </script>
@@ -16,7 +16,7 @@
16
16
  public function app_complete():void{
17
17
  // Dangoの接続処理
18
18
  try{
19
- dango_as3mode = new DangoAS3Mode({"server_host":"localhost", "server_port":15000});
19
+ dango_as3mode = new DangoAS3Mode({"server_host":"localhost", "server_port":15000, "debug":true});
20
20
  } catch (err:DangoError) {
21
21
  trace("接続エラー:failed to socket initialize.");
22
22
  }
@@ -38,17 +38,19 @@
38
38
 
39
39
  // 接続完了時に、テキストエリアに「接続完了」と表示します。
40
40
  private function dango__connect(evt:DangoAS3ModeReceiveEvent):void{
41
- log.text += "接続完了\n"
41
+ log.text += "接続完了" + dango_as3mode.sid + "\n"
42
42
  }
43
43
 
44
44
  // メッセージを受け取った時に、テキストエリアに受け取ったメッセージを表示します。
45
45
  private function dango_as3mode_receive(evt:DangoAS3ModeReceiveEvent):void{
46
+ trace("dango_as3mode_receive");
46
47
  log.text += evt.receive_data["chat"] + "\n"
47
48
  }
48
49
 
49
50
  // ボタンをクリックした時に全クライアントにchatメッセージを送信します
50
51
  public function click():void{
51
- dango_as3mode.send_object({"chat":input.text}, dango_as3mode.all_sid_list);
52
+ // 第2引数はsid一覧、空配列だと接続中の全クライアント
53
+ dango_as3mode.send_object({"chat":input.text}, []);
52
54
  }
53
55
  ]]>
54
56
  </mx:Script>
@@ -11,31 +11,44 @@ class DangoServer < DangoServerFramework
11
11
 
12
12
  # クライアント接続時に呼び出されるメソッド
13
13
  def dango_connect()
14
+ current_sids = []
14
15
  shared.transaction(:sids) do |sids|
15
16
  sids.push(session[:sid])
17
+ current_sids = sids.deep_dup
16
18
  shared.commit(sids)
17
19
  end
18
20
 
19
- send_obj = {:sids => shared[:sids]} # 全員に現在のsid一覧を送る
20
- send_notice(:notice_current_sids, shared[:sids], send_obj)
21
+ send_obj = {:sids => current_sids} # 全員に現在のsid一覧を送る
22
+ send_notice(:notice_current_sids, current_sids, send_obj)
21
23
  end
22
24
 
23
25
  # クライアント接続解除時に呼び出されるメソッド
24
26
  def dango_close()
27
+ current_sids = []
25
28
  shared.transaction(:sids) do |sids|
26
29
  sids.delete(session[:sid])
30
+ current_sids = sids.deep_dup
27
31
  shared.commit(sids)
28
32
  end
29
33
 
30
- send_obj = {:sids => shared[:sids]} # 全員に現在のsid一覧を送る
31
- send_notice(:notice_current_sids, shared[:sids], send_obj)
34
+ send_obj = {:sids => current_sids} # 全員に現在のsid一覧を送る
35
+ send_notice(:notice_current_sids, current_sids, send_obj)
32
36
  end
33
37
 
34
38
  # オブジェクトを特定sidに送信する
35
39
  def dango_receive_send_object(rec_obj)
36
40
  send_obj = rec_obj["object"]
37
- send_obj[:_from_sid] = session[:sid]
38
- send_notice(:notice_send_object, rec_obj["sids"], send_obj)
41
+ to_sids = rec_obj["sids"]
42
+ current_sids = shared[:sids]
43
+ if to_sids.is_a?(Array)
44
+ if to_sids == []
45
+ to_sids = current_sids
46
+ else
47
+ to_sids.delete_if {|sid| !current_sids.include?(sids) }
48
+ end
49
+ send_obj[:_from_sid] = session[:sid]
50
+ send_notice(:notice_send_object, to_sids, send_obj)
51
+ end
39
52
  end
40
53
  end
41
54
 
@@ -155,10 +155,24 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
155
155
 
156
156
  function AC_AddExtension(src, ext)
157
157
  {
158
- if (src.indexOf('?') != -1)
159
- return src.replace(/\?/, ext+'?');
158
+ var qIndex = src.indexOf('?');
159
+ if ( qIndex != -1)
160
+ {
161
+ // Add the extention (if needed) before the query params
162
+ var path = src.substring(0, qIndex);
163
+ if (path.length >= ext.length && path.lastIndexOf(ext) == (path.length - ext.length))
164
+ return src;
165
+ else
166
+ return src.replace(/\?/, ext+'?');
167
+ }
160
168
  else
161
- return src + ext;
169
+ {
170
+ // Add the extension (if needed) to the end of the URL
171
+ if (src.length >= ext.length && src.lastIndexOf(ext) == (src.length - ext.length))
172
+ return src; // Already have extension
173
+ else
174
+ return src + ext;
175
+ }
162
176
  }
163
177
 
164
178
  function AC_Generateobj(objAttrs, params, embedAttrs)
@@ -33,11 +33,11 @@ body { margin: 0px; overflow:hidden }
33
33
  // -----------------------------------------------------------------------------
34
34
  // Globals
35
35
  // Major version of Flash required
36
- var requiredMajorVersion = 9;
36
+ var requiredMajorVersion = 10;
37
37
  // Minor version of Flash required
38
38
  var requiredMinorVersion = 0;
39
39
  // Minor version of Flash required
40
- var requiredRevision = 124;
40
+ var requiredRevision = 2;
41
41
  // -----------------------------------------------------------------------------
42
42
  // -->
43
43
  </script>
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- CanReadOptionServer = %w(host max_connections log_file log_level log_max_size log_shift_age gserver_log_file)
3
+ CanReadOptionServer = %w(host max_connections log_file log_level log_max_size log_shift_age gserver_log_file no_start_log daemon)
4
4
  CanReadOptionNetwork = %w(host port)
5
5
 
6
6
  # コマンドラインオプション取得とコンフィグの上書き
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dango_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keisuke Minami
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-05 00:00:00 +09:00
12
+ date: 2008-12-01 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency