jpmobile 1.0.0.pre.4 → 1.0.0.pre.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +4 -0
- data/Gemfile +3 -3
- data/VERSION.yml +2 -2
- data/jpmobile.gemspec +335 -0
- data/lib/jpmobile.rb +0 -1
- data/lib/jpmobile/email.rb +47 -21
- data/lib/jpmobile/mail.rb +33 -26
- data/lib/jpmobile/mailer.rb +2 -0
- data/lib/jpmobile/util.rb +3 -3
- data/spec/unit/email-fixtures/au-attached.eml +1551 -0
- data/spec/unit/email-fixtures/au-decomail.eml +44 -0
- data/spec/unit/email-fixtures/au-emoji.eml +19 -0
- data/spec/unit/email-fixtures/au-emoji2.eml +45 -0
- data/spec/unit/email-fixtures/au-emoji5.eml +24 -0
- data/spec/unit/email-fixtures/docomo-emoji.eml +19 -0
- data/spec/unit/email-fixtures/docomo-gmail-sjis.eml +45 -0
- data/spec/unit/email-fixtures/docomo-jis.eml +20 -0
- data/spec/unit/email-fixtures/pc-mail-multi.eml +77 -0
- data/spec/unit/email-fixtures/pc-mail-single.eml +29 -0
- data/spec/unit/email-fixtures/softbank-blank.eml +20 -0
- data/spec/unit/email-fixtures/softbank-emoji-utf8.eml +19 -0
- data/spec/unit/email-fixtures/softbank-emoji.eml +19 -0
- data/spec/unit/email-fixtures/softbank-gmail-sjis.eml +45 -0
- data/spec/unit/email-fixtures/softbank-gmail-utf8.eml +45 -0
- data/spec/unit/{detect_by_email_spec.rb → email_spec.rb} +25 -2
- data/spec/unit/emoticon_spec.rb +1 -1
- data/spec/unit/encoding_spec.rb +1 -1
- data/spec/unit/is_carrier_spec.rb +1 -1
- data/spec/unit/mail_spec.rb +1 -1
- data/spec/unit/receive_mail_spec.rb +26 -1
- data/spec/unit/util_spec.rb +1 -1
- data/spec/unit/valid_ip_spec.rb +1 -1
- data/test/rails/.gitignore +1 -0
- data/test/rails/overrides/.rspec +5 -0
- data/test/rails/overrides/Gemfile +33 -0
- data/test/rails/overrides/app/views/filter/index.html.erb +0 -0
- data/test/rails/overrides/app/views/hankaku_filter/index.html.erb +0 -0
- data/test/rails/overrides/app/views/hankaku_input_filter/index.html.erb +0 -0
- data/test/rails/overrides/app/views/hankaku_input_filter/index_xhtml.html.erb +1 -0
- data/test/rails/overrides/app/views/layouts/xhtml.html.erb +12 -0
- data/test/rails/overrides/app/views/links/au_gps.html.erb +1 -0
- data/test/rails/overrides/app/views/links/au_location.html.erb +1 -0
- data/test/rails/overrides/app/views/links/docomo_foma_gps.html.erb +1 -0
- data/test/rails/overrides/app/views/links/docomo_openiarea.html.erb +1 -0
- data/test/rails/overrides/app/views/links/docomo_utn.html.erb +1 -0
- data/test/rails/overrides/app/views/links/link.html.erb +1 -0
- data/test/rails/overrides/app/views/links/show_all.html.erb +1 -0
- data/test/rails/overrides/app/views/links/softbank_location.html.erb +1 -0
- data/test/rails/overrides/app/views/links/willcom_location.html.erb +1 -0
- data/test/rails/overrides/app/views/mobile_mailer/multi_message.html.erb +11 -0
- data/test/rails/overrides/app/views/mobile_mailer/multi_message.text.erb +2 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection.html.erb +3 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile.html.erb +3 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_au.html.erb +3 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_docomo.html.erb +3 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_emobile.html.erb +3 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_softbank.html.erb +3 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_vodafone.html.erb +3 -0
- data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_willcom.html.erb +3 -0
- data/test/rails/overrides/app/views/normal_mailer/msg.text.erb +3 -0
- data/test/rails/overrides/app/views/template_path/_partial.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/_partial_mobile.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/_partial_mobile_docomo.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/_partial_smart_phone.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/_partial_smart_phone_iphone.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/index.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/index_mobile.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/index_mobile_docomo.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/index_smart_phone.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/index_smart_phone_iphone.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/partial.html.erb +2 -0
- data/test/rails/overrides/app/views/template_path/show_mobile.html.erb +1 -0
- data/test/rails/overrides/app/views/template_path/show_mobile_docomo.html.erb +1 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/au-attached.eml +1551 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/au-decomail.eml +44 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji.eml +19 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji2.eml +45 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji5.eml +24 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-emoji.eml +19 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-gmail-sjis.eml +45 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-jis.eml +20 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/no-from.eml +78 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/non-jp.eml +45 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-blank.eml +20 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji-utf8.eml +19 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji.eml +19 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-sjis.eml +45 -0
- data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-utf8.eml +45 -0
- data/test/rails/overrides/spec/helpers/helpers_spec.rb +1 -2
- data/test/rails/overrides/spec/models/mobile_mailer_spec.rb +37 -1
- data/test/rails/overrides/spec/models/normal_mailer_spec.rb +1 -1
- data/test/rails/overrides/spec/rcov.opts +2 -0
- data/test/rails/overrides/spec/requests/docomo_guid_spec.rb +1 -2
- data/test/rails/overrides/spec/requests/docomo_spec.rb +1 -2
- data/test/rails/overrides/spec/requests/emobile_spec.rb +1 -2
- data/test/rails/overrides/spec/requests/filter_spec.rb +1 -1
- data/test/rails/overrides/spec/requests/helpers_spec.rb +1 -1
- data/test/rails/overrides/spec/requests/pc_spec.rb +1 -2
- data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +1 -2
- data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -2
- data/test/rails/overrides/spec/requests/trans_sid_spec.rb +1 -2
- data/test/rails/overrides/spec/spec_helper.rb +1 -1
- metadata +229 -386
- data/test/rails/rails_root/app/controllers/application_controller.rb +0 -6
- data/test/rails/rails_root/app/controllers/docomo_guid_always_controller.rb +0 -3
- data/test/rails/rails_root/app/controllers/docomo_guid_base_controller.rb +0 -5
- data/test/rails/rails_root/app/controllers/docomo_guid_docomo_controller.rb +0 -3
- data/test/rails/rails_root/app/controllers/filter_controller.rb +0 -3
- data/test/rails/rails_root/app/controllers/filter_controller_base.rb +0 -25
- data/test/rails/rails_root/app/controllers/hankaku_filter_controller.rb +0 -3
- data/test/rails/rails_root/app/controllers/hankaku_input_filter_controller.rb +0 -7
- data/test/rails/rails_root/app/controllers/links_controller.rb +0 -28
- data/test/rails/rails_root/app/controllers/mobile_spec_controller.rb +0 -5
- data/test/rails/rails_root/app/controllers/template_path_controller.rb +0 -17
- data/test/rails/rails_root/app/controllers/trans_sid_always_and_session_off_controller.rb +0 -4
- data/test/rails/rails_root/app/controllers/trans_sid_always_controller.rb +0 -3
- data/test/rails/rails_root/app/controllers/trans_sid_base_controller.rb +0 -40
- data/test/rails/rails_root/app/controllers/trans_sid_metal_controller.rb +0 -15
- data/test/rails/rails_root/app/controllers/trans_sid_mobile_controller.rb +0 -3
- data/test/rails/rails_root/app/controllers/trans_sid_none_controller.rb +0 -3
- data/test/rails/rails_root/app/helpers/application_helper.rb +0 -2
- data/test/rails/rails_root/app/models/mobile_mailer.rb +0 -19
- data/test/rails/rails_root/app/models/normal_mailer.rb +0 -9
- data/test/rails/rails_root/app/models/user.rb +0 -2
- data/test/rails/rails_root/autotest/discover.rb +0 -2
- data/test/rails/rails_root/config/application.rb +0 -42
- data/test/rails/rails_root/config/boot.rb +0 -6
- data/test/rails/rails_root/config/environment.rb +0 -5
- data/test/rails/rails_root/config/environments/development.rb +0 -26
- data/test/rails/rails_root/config/environments/production.rb +0 -49
- data/test/rails/rails_root/config/environments/test.rb +0 -35
- data/test/rails/rails_root/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails/rails_root/config/initializers/inflections.rb +0 -10
- data/test/rails/rails_root/config/initializers/jpmobile_generator.rb +0 -2
- data/test/rails/rails_root/config/initializers/mime_types.rb +0 -5
- data/test/rails/rails_root/config/initializers/secret_token.rb +0 -7
- data/test/rails/rails_root/config/initializers/session_store.rb +0 -2
- data/test/rails/rails_root/config/routes.rb +0 -7
- data/test/rails/rails_root/db/migrate/001_add_sessions_table.rb +0 -16
- data/test/rails/rails_root/db/migrate/20100824062306_create_users.rb +0 -13
- data/test/rails/rails_root/db/schema.rb +0 -31
- data/test/rails/rails_root/db/seeds.rb +0 -7
- data/test/rails/rails_root/spec/helpers/helpers_spec.rb +0 -15
- data/test/rails/rails_root/spec/models/mobile_mailer_spec.rb +0 -737
- data/test/rails/rails_root/spec/models/normal_mailer_spec.rb +0 -34
- data/test/rails/rails_root/spec/requests/docomo_guid_spec.rb +0 -102
- data/test/rails/rails_root/spec/requests/docomo_spec.rb +0 -33
- data/test/rails/rails_root/spec/requests/emobile_spec.rb +0 -53
- data/test/rails/rails_root/spec/requests/filter_spec.rb +0 -221
- data/test/rails/rails_root/spec/requests/helpers_spec.rb +0 -187
- data/test/rails/rails_root/spec/requests/pc_spec.rb +0 -22
- data/test/rails/rails_root/spec/requests/softbank_emulator_spec.rb +0 -21
- data/test/rails/rails_root/spec/requests/template_path_spec.rb +0 -240
- data/test/rails/rails_root/spec/requests/trans_sid_spec.rb +0 -207
- data/test/rails/rails_root/spec/spec_helper.rb +0 -38
- data/test/rails/rails_root/test/performance/browsing_test.rb +0 -9
- data/test/rails/rails_root/test/test_helper.rb +0 -13
- data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
- data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
- data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
- data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
- data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
- data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
- data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
- data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
- data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
- data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
- data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/spec_helper.rb +0 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
- data/test/rails/rails_root/vendor/plugins/jpmobile/init.rb +0 -3
- data/test/rails/rails_root/vendor/plugins/jpmobile/install.rb +0 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +0 -59
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/datum_conv.rb +0 -72
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb +0 -43
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb +0 -33
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +0 -205
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/au.rb +0 -1931
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb +0 -3909
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/docomo.rb +0 -255
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/softbank.rb +0 -965
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb +0 -36
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/encoding.rb +0 -29
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +0 -113
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +0 -174
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +0 -18
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_dispatch.rb +0 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +0 -33
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/lookup_context.rb +0 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mail.rb +0 -330
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mailer.rb +0 -41
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +0 -168
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/android.rb +0 -10
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +0 -128
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/ddipocket.rb +0 -12
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +0 -149
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/emobile.rb +0 -16
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/iphone.rb +0 -26
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/smart_phone.rb +0 -21
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +0 -91
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/vodafone.rb +0 -17
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb +0 -28
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/windows_phone.rb +0 -10
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/path_set.rb +0 -40
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb +0 -68
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack.rb +0 -49
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/filter.rb +0 -50
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/mobile_carrier.rb +0 -33
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/params_filter.rb +0 -47
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rails.rb +0 -50
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb +0 -45
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/resolver.rb +0 -38
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +0 -133
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +0 -370
- data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/conversion-table.rb +0 -2588
- data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/utf8_to_image.rb +0 -1407
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/emoji/genregexp.rb +0 -47
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_au_emoticon_table.rb +0 -34
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_docomo_emoticon_table.rb +0 -33
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_emoticon_conversion_table.rb +0 -107
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_softbank_emoticon_table.rb +0 -31
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/list_gps_unsupported_au.rb +0 -23
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/spec_helper.rb +0 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# =EMOBILE携帯電話
|
3
|
-
|
4
|
-
module Jpmobile::Mobile
|
5
|
-
# ==EMOBILE携帯電話
|
6
|
-
class Emobile < AbstractMobile
|
7
|
-
USER_AGENT_REGEXP = %r{^emobile/|^Mozilla/5.0 \(H11T; like Gecko; OpenBrowser\) NetFront/3.4$|^Mozilla/4.0 \(compatible; MSIE 6.0; Windows CE; IEMobile 7.7\) S11HT$}
|
8
|
-
# 対応するメールアドレスの正規表現
|
9
|
-
MAIL_ADDRESS_REGEXP = /.+@emnet\.ne\.jp/
|
10
|
-
# EMnet対応端末から通知されるユニークなユーザIDを取得する。
|
11
|
-
def em_uid
|
12
|
-
@request.env['HTTP_X_EM_UID']
|
13
|
-
end
|
14
|
-
alias :ident_subscriber :em_uid
|
15
|
-
end
|
16
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# =iPhone
|
3
|
-
|
4
|
-
module Jpmobile::Mobile
|
5
|
-
# ==iPhone
|
6
|
-
class Iphone < SmartPhone
|
7
|
-
# 対応するUser-Agentの正規表現
|
8
|
-
USER_AGENT_REGEXP = /iPhone/
|
9
|
-
|
10
|
-
# 文字コード変換
|
11
|
-
def to_internal(str)
|
12
|
-
# 絵文字を数値参照に変換
|
13
|
-
str = Jpmobile::Emoticon.external_to_unicodecr_softbank(Jpmobile::Util.utf8(str))
|
14
|
-
# 数値参照を UTF-8 に変換
|
15
|
-
Jpmobile::Emoticon.unicodecr_to_utf8(str)
|
16
|
-
end
|
17
|
-
def to_external(str, content_type, charset)
|
18
|
-
# UTF-8を数値参照に
|
19
|
-
str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
|
20
|
-
# 数値参照を絵文字コードに変換
|
21
|
-
str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, false)
|
22
|
-
|
23
|
-
[str, charset]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# =スマートフォンの親クラス
|
3
|
-
|
4
|
-
module Jpmobile::Mobile
|
5
|
-
class SmartPhone < AbstractMobile
|
6
|
-
# 無効化
|
7
|
-
def valid_ip?
|
8
|
-
false
|
9
|
-
end
|
10
|
-
|
11
|
-
# cookie は有効と見なす
|
12
|
-
def supports_cookie?
|
13
|
-
true
|
14
|
-
end
|
15
|
-
|
16
|
-
# smartphone なので true
|
17
|
-
def smart_phone?
|
18
|
-
true
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# =SoftBank携帯電話
|
3
|
-
# Vodafoneを含む
|
4
|
-
module Jpmobile::Mobile
|
5
|
-
# ==Softbank携帯電話
|
6
|
-
# Vodafoneのスーパクラス。
|
7
|
-
class Softbank < AbstractMobile
|
8
|
-
# 対応するuser-agentの正規表現
|
9
|
-
USER_AGENT_REGEXP = /^(?:SoftBank|Semulator)/
|
10
|
-
# 対応するメールアドレスの正規表現 ディズニーモバイル対応
|
11
|
-
MAIL_ADDRESS_REGEXP = /.+@(?:softbank\.ne\.jp|disney\.ne\.jp)/
|
12
|
-
# メールのデフォルトのcharset
|
13
|
-
MAIL_CHARSET = "Shift_JIS"
|
14
|
-
|
15
|
-
# 製造番号を返す。無ければ +nil+ を返す。
|
16
|
-
def serial_number
|
17
|
-
@request.env['HTTP_USER_AGENT'] =~ /SN(.+?) /
|
18
|
-
return $1
|
19
|
-
end
|
20
|
-
alias :ident_device :serial_number
|
21
|
-
|
22
|
-
# UIDを返す。
|
23
|
-
def x_jphone_uid
|
24
|
-
@request.env["HTTP_X_JPHONE_UID"]
|
25
|
-
end
|
26
|
-
alias :ident_subscriber :x_jphone_uid
|
27
|
-
|
28
|
-
# 位置情報があれば Position のインスタンスを返す。無ければ +nil+ を返す。
|
29
|
-
def position
|
30
|
-
return @__position if defined? @__position
|
31
|
-
if params["pos"] =~ /^([NS])(\d+)\.(\d+)\.(\d+\.\d+)([WE])(\d+)\.(\d+)\.(\d+\.\d+)$/
|
32
|
-
raise "Unsupported datum" if params["geo"] != "wgs84"
|
33
|
-
l = Jpmobile::Position.new
|
34
|
-
l.lat = ($1=="N" ? 1 : -1) * Jpmobile::Position.dms2deg($2,$3,$4)
|
35
|
-
l.lon = ($5=="E" ? 1 : -1) * Jpmobile::Position.dms2deg($6,$7,$8)
|
36
|
-
l.options = params.reject {|x,v| !["pos","geo","x-acr"].include?(x) }
|
37
|
-
return @__position = l
|
38
|
-
else
|
39
|
-
return @__position = nil
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# cookieに対応しているか?
|
44
|
-
def supports_cookie?
|
45
|
-
true
|
46
|
-
end
|
47
|
-
|
48
|
-
# 文字コード変換
|
49
|
-
def to_internal(str)
|
50
|
-
# 絵文字を数値参照に変換
|
51
|
-
str = Jpmobile::Emoticon.external_to_unicodecr_softbank(Jpmobile::Util.utf8(str))
|
52
|
-
# 数値参照を UTF-8 に変換
|
53
|
-
Jpmobile::Emoticon::unicodecr_to_utf8(str)
|
54
|
-
end
|
55
|
-
def to_external(str, content_type, charset)
|
56
|
-
# UTF-8を数値参照に
|
57
|
-
str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
|
58
|
-
# 数値参照を絵文字コードに変換
|
59
|
-
str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, false)
|
60
|
-
|
61
|
-
[str, charset]
|
62
|
-
end
|
63
|
-
|
64
|
-
# メール送信用
|
65
|
-
def to_mail_body(str)
|
66
|
-
to_mail_encoding(str)
|
67
|
-
end
|
68
|
-
def to_mail_internal(str, charset)
|
69
|
-
# 絵文字を数値参照に変換
|
70
|
-
if Jpmobile::Util.utf8?(str) or charset == "UTF-8"
|
71
|
-
# UTF-8
|
72
|
-
str = Jpmobile::Emoticon.external_to_unicodecr_softbank(Jpmobile::Util.utf8(str))
|
73
|
-
elsif Jpmobile::Util.shift_jis?(str) or Jpmobile::Util.ascii_8bit?(str) or charset == mail_charset
|
74
|
-
# Shift_JIS
|
75
|
-
str = Jpmobile::Emoticon.external_to_unicodecr_softbank_sjis(Jpmobile::Util.sjis(str))
|
76
|
-
end
|
77
|
-
|
78
|
-
str
|
79
|
-
end
|
80
|
-
def to_mail_body_encoded?(str)
|
81
|
-
Jpmobile::Util.shift_jis?(str)
|
82
|
-
end
|
83
|
-
|
84
|
-
private
|
85
|
-
def to_mail_encoding(str)
|
86
|
-
str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
|
87
|
-
str = Jpmobile::Util.utf8_to_sjis(str)
|
88
|
-
Jpmobile::Emoticon.unicodecr_to_softbank_email(str)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# Vodafone
|
3
|
-
module Jpmobile::Mobile
|
4
|
-
# ==Vodafone 3G携帯電話(SoftBank含まず)
|
5
|
-
# スーパクラスはSoftbank。
|
6
|
-
class Vodafone < Softbank
|
7
|
-
# 対応するUser-Agentの正規表現
|
8
|
-
USER_AGENT_REGEXP = /^(Vodafone|Vemulator)/
|
9
|
-
# 対応するメールアドレスの正規表現
|
10
|
-
MAIL_ADDRESS_REGEXP = /.+@[dhtcrknsq]\.vodafone\.ne\.jp/
|
11
|
-
|
12
|
-
# cookieに対応しているか?
|
13
|
-
def supports_cookie?
|
14
|
-
true
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# =Willcom携帯電話
|
3
|
-
module Jpmobile::Mobile
|
4
|
-
# ==Willcom携帯電話
|
5
|
-
# Ddipocketのスーパクラス。
|
6
|
-
class Willcom < AbstractMobile
|
7
|
-
# 対応するUser-Agentの正規表現
|
8
|
-
USER_AGENT_REGEXP = /^Mozilla\/3.0\(WILLCOM/
|
9
|
-
# 対応するメールアドレスの正規表現
|
10
|
-
MAIL_ADDRESS_REGEXP = /.+@((.+\.)?pdx\.ne\.jp|willcom\.com)/
|
11
|
-
|
12
|
-
# 位置情報があれば Position のインスタンスを返す。無ければ +nil+ を返す。
|
13
|
-
def position
|
14
|
-
return @__position if defined? @__position
|
15
|
-
return @__position = nil if ( params["pos"].nil? || params['pos'] == '' )
|
16
|
-
raise "unsupported format" unless params["pos"] =~ /^N(\d\d)\.(\d\d)\.(\d\d\.\d\d\d)E(\d\d\d)\.(\d\d)\.(\d\d\.\d\d\d)$/
|
17
|
-
pos = Jpmobile::Position.new
|
18
|
-
pos.lat = Jpmobile::Position.dms2deg($1,$2,$3)
|
19
|
-
pos.lon = Jpmobile::Position.dms2deg($4,$5,$6)
|
20
|
-
pos.tokyo2wgs84!
|
21
|
-
return @__position = pos
|
22
|
-
end
|
23
|
-
# cookieに対応しているか?
|
24
|
-
def supports_cookie?
|
25
|
-
true
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module Jpmobile
|
2
|
-
class PathSet < Array
|
3
|
-
%w(initialize << concat insert push unshift).each do |method|
|
4
|
-
class_eval <<-METHOD, __FILE__, __LINE__ + 1
|
5
|
-
def #{method}(*args)
|
6
|
-
super
|
7
|
-
typecast!
|
8
|
-
end
|
9
|
-
METHOD
|
10
|
-
end
|
11
|
-
|
12
|
-
def find(path, prefix = nil, partial = false, details = {}, key = nil)
|
13
|
-
template = find_all(path, prefix, partial, details, key).first
|
14
|
-
raise MissingTemplate.new(self, "#{prefix}/#{path}", details, partial) unless template
|
15
|
-
template
|
16
|
-
end
|
17
|
-
|
18
|
-
def find_all(*args)
|
19
|
-
each do |resolver|
|
20
|
-
templates = resolver.find_all(*args)
|
21
|
-
return templates unless templates.empty?
|
22
|
-
end
|
23
|
-
[]
|
24
|
-
end
|
25
|
-
|
26
|
-
def exists?(*args)
|
27
|
-
find_all(*args).any?
|
28
|
-
end
|
29
|
-
|
30
|
-
protected
|
31
|
-
|
32
|
-
def typecast!
|
33
|
-
each_with_index do |path, i|
|
34
|
-
path = path.to_s if path.is_a?(Pathname)
|
35
|
-
next unless path.is_a?(String)
|
36
|
-
self[i] = Jpmobile::Resolver.new(path)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
#= 位置情報
|
3
|
-
|
4
|
-
# Rack 化にあわせて gem を見るように
|
5
|
-
begin
|
6
|
-
require 'geokit'
|
7
|
-
rescue LoadError
|
8
|
-
end
|
9
|
-
|
10
|
-
module Jpmobile
|
11
|
-
# 位置情報
|
12
|
-
class Position
|
13
|
-
if Object.const_defined?("GeoKit")
|
14
|
-
# GeoKitが読み込まれている場合はMappableにする
|
15
|
-
include ::GeoKit::Mappable
|
16
|
-
def self.acts_as_mappable; end
|
17
|
-
def self.distance_column_name; end
|
18
|
-
def self.lat_column_name; :lat; end
|
19
|
-
def self.lng_column_name; :lng; end
|
20
|
-
end
|
21
|
-
def initialize
|
22
|
-
@lat = nil
|
23
|
-
@lon = nil
|
24
|
-
@options = {}
|
25
|
-
end
|
26
|
-
# 度分秒を度に変換する。
|
27
|
-
def self.dms2deg(d,m,s)
|
28
|
-
return d.to_i + m.to_i.to_f/60 + s.to_f/3600
|
29
|
-
end
|
30
|
-
# 日本測地系から世界測地系に変換する。
|
31
|
-
def tokyo2wgs84!
|
32
|
-
@lat, @lon = DatumConv.tky2jgd(@lat,@lon)
|
33
|
-
end
|
34
|
-
# 文字列で緯度経度を返す。
|
35
|
-
def to_s
|
36
|
-
sprintf("%s%f%s%f", @lat>0 ? 'N' : 'S', @lat, @lon>0 ? 'E' : 'W', @lon)
|
37
|
-
end
|
38
|
-
|
39
|
-
# 緯度経度をカンマ区切りで返す
|
40
|
-
def ll
|
41
|
-
"#{lat},#{lng}"
|
42
|
-
end
|
43
|
-
|
44
|
-
# 緯度
|
45
|
-
attr_accessor :lat
|
46
|
-
|
47
|
-
# 経度
|
48
|
-
attr_accessor :lon
|
49
|
-
|
50
|
-
# 経度
|
51
|
-
def lng
|
52
|
-
lon
|
53
|
-
end
|
54
|
-
|
55
|
-
# 経度を設定
|
56
|
-
def lng=(l)
|
57
|
-
lon = l
|
58
|
-
end
|
59
|
-
|
60
|
-
# 緯度と経度が一致している場合に +true+
|
61
|
-
def ==(x)
|
62
|
-
x.lat == lat && x.lon == lon
|
63
|
-
end
|
64
|
-
|
65
|
-
# その他の情報
|
66
|
-
attr_accessor :options
|
67
|
-
end
|
68
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'rack/utils'
|
3
|
-
|
4
|
-
module Jpmobile
|
5
|
-
module Rack
|
6
|
-
module_function
|
7
|
-
def mount_middlewares
|
8
|
-
# 漢字コード・絵文字フィルター
|
9
|
-
::Rails.application.middleware.insert_before('ActionDispatch::ParamsParser', Jpmobile::Rack::ParamsFilter)
|
10
|
-
::Rails.application.middleware.insert_before('ActionDispatch::ParamsParser', Jpmobile::Rack::Filter)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Configuration
|
15
|
-
attr_accessor :form_accept_charset_conversion
|
16
|
-
|
17
|
-
def initialize
|
18
|
-
@form_accept_charset_conversion = false
|
19
|
-
end
|
20
|
-
|
21
|
-
def mobile_filter
|
22
|
-
::Jpmobile::Rack.mount_middlewares
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
module Rack
|
28
|
-
class Request
|
29
|
-
def params
|
30
|
-
self.GET.merge(self.POST)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# UTF-8 で match させるようにする
|
35
|
-
module Utils
|
36
|
-
def escape(s)
|
37
|
-
s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/) {
|
38
|
-
'%'+$1.unpack('H2'*bytesize($1)).join('%').upcase
|
39
|
-
}.tr(' ', '+')
|
40
|
-
end
|
41
|
-
module_function :escape
|
42
|
-
def unescape(s)
|
43
|
-
s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/){
|
44
|
-
[$1.delete('%')].pack('H*')
|
45
|
-
}
|
46
|
-
end
|
47
|
-
module_function :unescape
|
48
|
-
end
|
49
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# 出力変換
|
3
|
-
module Jpmobile
|
4
|
-
module Rack
|
5
|
-
class Filter
|
6
|
-
def initialize(app)
|
7
|
-
@app = app
|
8
|
-
end
|
9
|
-
|
10
|
-
def call(env)
|
11
|
-
# 入力を保存
|
12
|
-
mobile = env['rack.jpmobile']
|
13
|
-
|
14
|
-
status, env, response = @app.call(env)
|
15
|
-
|
16
|
-
if mobile and env['Content-Type'] =~ %r!text/html|application/xhtml\+xml!
|
17
|
-
type, charset = env['Content-Type'].split(/;\s*charset=/)
|
18
|
-
|
19
|
-
body = response_to_body(response)
|
20
|
-
body = body.gsub(/<input name="utf8" type="hidden" value="#{[0x2713].pack("U")}"[^>]*?>/, ' ')
|
21
|
-
body = body.gsub(/<input name="utf8" type="hidden" value="✓"[^>]*?>/, ' ')
|
22
|
-
|
23
|
-
response, charset = mobile.to_external(body, type, charset)
|
24
|
-
|
25
|
-
if type and charset
|
26
|
-
env['Content-Type'] = "#{type}; charset=#{charset}"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
new_response = ::Rack::Response.new(response, status, env)
|
31
|
-
new_response.finish
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
def response_to_body(response)
|
36
|
-
if response.respond_to?(:to_str)
|
37
|
-
response.to_str
|
38
|
-
elsif response.respond_to?(:each)
|
39
|
-
body = []
|
40
|
-
response.each do |part|
|
41
|
-
body << response_to_body(part)
|
42
|
-
end
|
43
|
-
body.join("\n")
|
44
|
-
else
|
45
|
-
body
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# UserAgent から生成すべき class 名を判定する
|
3
|
-
module Jpmobile
|
4
|
-
module Rack
|
5
|
-
class MobileCarrier
|
6
|
-
def initialize(app)
|
7
|
-
@app = app
|
8
|
-
end
|
9
|
-
|
10
|
-
def call(env)
|
11
|
-
env['rack.jpmobile'] = carrier(env)
|
12
|
-
|
13
|
-
@app.call(env)
|
14
|
-
end
|
15
|
-
|
16
|
-
def carrier(env)
|
17
|
-
::Jpmobile::Mobile.carriers.each do |const|
|
18
|
-
c = ::Jpmobile::Mobile.const_get(const)
|
19
|
-
if c.check_carrier(env)
|
20
|
-
res = ::Rack::Request.new(env)
|
21
|
-
return c.new(env, res)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
nil
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class Rack::Request
|
32
|
-
include Jpmobile::RequestWithMobile
|
33
|
-
end
|