TODO: is_emobile*() logic is somewhat ugly.
+2008-05-12 Makoto Matsushita <matusita@jp.FreeBSD.org>
+
+ * keitairc, etc/dot.keitairc, lib/Keitairc/ClientInfo.pm,
+ lib/Keitairc/Config.pm, lib/Keitairc/View.pm,
+ lib/plugins/00location_receiver, lib/templates/location.html:
+ emobile\e$BC<Kv%5%]!<%H!%%f!<%6\e(BID(x-em-uid)\e$B$K$h$k%f!<%6G'>Z!$$*$h$S0L\e(B
+ \e$BCV>pJsAw?.\e(B(\e$B8=;~E@$G$O\e(BH11T\e$B$N$_\e(B)\e$B$KBP1~!%\e(B Closes #12453.
+
2008-05-11 ISHIKAWA Mutsumi <ishikawa@debian.org>
* keitairc
#
# sample ~/.keitairc for keitairc 2.x
#
-# $Id: dot.keitairc,v 1.13 2008-05-10 05:27:54 matusita Exp $
+# $Id: dot.keitairc,v 1.14 2008-05-13 02:53:31 matusita Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/etc/dot.keitairc,v $
################################################################
# Softbank
# softbank_serial_key = XXXXXXXXXXXXXXXXXXXXXXX
+# E-MOBILE
+# emobile_userid = uXXXXXXXXXXXXXXXXX
+
################################################################
# Advanced setup
################################################################
#!/usr/bin/perl
# keitairc
-# $Id: keitairc,v 1.54 2008-05-11 12:24:54 ishikawa Exp $
+# $Id: keitairc,v 1.55 2008-05-13 02:53:31 matusita Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/keitairc,v $
#
# Copyright (c) 2003-2008 Jun Morimoto <morimoto@mrmt.net>
}
}
+ if($ci->is_emobile()){
+ my $userid = $ci->{header}->{x_em_uid};
+ if(length $userid){
+ if(my $s = $sm->verify({serial_key => $userid,
+ user_agent => $ci->user_agent()})){
+ ::log_debug("redirect to /$s->{id}/index from userid");
+ my $view = new Keitairc::View($cf, $ci, $s->{id});
+ return $view->redirect("/$s->{id}/index");
+ }
+
+ if($userid eq $cf->emobile_userid()){
+ my $s = $sm->add($ci->user_agent(), $userid);
+ ::log_debug("redirect to /$s->{id}/index from emobile_userid");
+ my $view = new Keitairc::View($cf, $ci, $s->{id});
+ return $view->redirect("/$s->{id}/index");
+ }
+ }
+ }
+
my $view = new Keitairc::View($cf, $ci);
return $view->render('root.html', {
docomo_foma_icc => $cf->docomo_foma_icc(),
# -*-perl-*-
# Keitairc::ClientInfo
-# $Id: ClientInfo.pm,v 1.3 2008-05-08 14:23:16 matusita Exp $
+# $Id: ClientInfo.pm,v 1.4 2008-05-13 02:53:31 matusita Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/ClientInfo.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
}
################################################################
+sub is_emobile{
+ my $me = shift;
+ $me->is_emobile_mobilebrowser() + $me->is_emobile_openbrowser();
+}
+
+################################################################
+sub is_emobile_mobilebrowser{
+ my $me = shift;
+ $me->{header}->{user_agent} =~ /^emobile/;
+}
+
+################################################################
+sub is_emobile_openbrowser{
+ my $me = shift;
+ # http://developer.emnet.ne.jp/useragent.html
+ $me->{header}->{user_agent} =~ /(H11T; like Gecko|\) S11HT$)/;
+}
+
+################################################################
sub is_mobile{
my $me = shift;
- $me->is_ezweb() + $me->is_docomo() + $me->is_softbank();
+ $me->is_ezweb() + $me->is_docomo()
+ + $me->is_softbank() + $me->is_emobile_mobilebrowser();
}
################################################################
}
################################################################
+sub userid{
+ my $me = shift;
+ $me->{header}->{x_em_uid};
+}
+
+################################################################
sub serial_key{
my $me = shift;
if($me->is_softbank()){
if($me->is_ezweb()){
return $me->subscribe_id();
}
+ if($me->is_emobile()){
+ return $me->userid();
+ }
}
################################################################
# -*-perl-*-
# Keitairc::Config
-# $Id: Config.pm,v 1.13 2008-05-10 05:27:54 matusita Exp $
+# $Id: Config.pm,v 1.14 2008-05-13 02:53:31 matusita Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/Config.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
irc_keyword
au_subscriber_id au_pcsv
docomo_foma_icc docomo_imodeid
- softbank_serial_key
+ softbank_serial_key emobile_userid
use_cookie cookie_ttl session_ttl
web_port web_title web_lines web_root
web_username web_password web_host
# -*-perl-*-
# Keitairc::View
-# $Id: View.pm,v 1.11 2008-05-10 05:27:54 matusita Exp $
+# $Id: View.pm,v 1.12 2008-05-13 02:53:31 matusita Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/View.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
$p->{is_docomo} = $me->{ClientInfo}->is_docomo();
$p->{is_ezweb} = $me->{ClientInfo}->is_ezweb();
$p->{is_softbank} = $me->{ClientInfo}->is_softbank();
+ $p->{is_emobile} = $me->{ClientInfo}->is_emobile();
$p->{is_mobile} = $me->{ClientInfo}->is_mobile();
map {
# keitairc/lib/plugins/00location_receiver
# °ÌÃÖ¾ðÊóÁ÷¿®¡¢¤Î¥³¡¼¥ë¥Ð¥Ã¥¯
#
-# $Id: 00location_receiver,v 1.9 2008-05-11 14:18:51 matusita Exp $
+# $Id: 00location_receiver,v 1.10 2008-05-13 02:53:31 matusita Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00location_receiver,v $
use Net::HTTP;
return $view->render('location_receiver.html', $p);
}
+ # http://developer.emnet.ne.jp/browser3-1.html
+ # Example:
+ # http://www.emobilemap.net/positioning.cgi?ver=MOPA-001-2001&pos=N35.44.33.156E135.22.33.124&geo=wgs84&x-acy=1
+ if($ci->is_emobile()){
+ unless(defined $h{pos}) {
+ $p->{error} = 1;
+ $p->{error_lcs} = 1;
+ return $view->render('location_receiver.html', $p);
+ }
+
+ my ($wx, $wy);
+ if($h{pos} =~ /N([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)E([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/){
+ ($wx, $wy) = ($1, $2);
+ }
+
+ ($wx, $wy) = (dms_to_degree($wx), dms_to_degree($wy));
+ my ($tx, $ty) = wgs84_to_tokyo($wx, $wy);
+ my $xml_code = get_rgeocode_xml($wx, $wy);
+ unless($xml_code){
+ $p->{error} = 1;
+ $p->{rgeocode_noresponse} = 1;
+ return $view->render('location_receiver.html', $p);
+ }
+
+ my $xml = XMLin($xml_code);
+ if($xml->{status} ne 'true'){
+ $p->{error} = 1;
+ $p->{rgeocode_invalid} = 1;
+ return $view->render('location_receiver.html', $p);
+ }
+ $p->{wx} = $wx;
+ $p->{wy} = $wy;
+ $p->{tx} = $tx;
+ $p->{ty} = $ty;
+ $p->{map_image_url} = google_map_image($wx, $wy, 'gif');
+ $p->{address} = $xml->{prefecture}->{pname} .
+ $xml->{municipality}->{mname} .
+ $xml->{local}->{section};
+ Encode::_utf8_off($p->{address}) if Encode::is_utf8($p->{address});
+ Encode::from_to($p->{address}, 'utf8', 'shiftjis');
+ return $view->render('location_receiver.html', $p);
+ }
+
return $view->render('location_receiver.html', $p);
}
};
<a accesskey="2" href="location:auto?url=http://<!-- tmpl_var web_host -->:<!-- tmpl_var root -->/<!-- tmpl_var session_id -->/location_receiver/<!-- tmpl_var cid -->">[2] \88Ê\92u\8fî\95ñ\91ª\92è(3GC\92[\96\96)</a><br />
</tmpl_if>
+ <tmpl_if is_emobile>
+ <a accesskey="1" href="<!-- tmpl_var root --><!-- tmpl_var session_id -->/location_receiver/<!-- tmpl_var cid -->" measure="auto">[1] GPS\88Ê\92u\91ª\92è</a><br />
+ <a accesskey="2" href="<!-- tmpl_var root --><!-- tmpl_var session_id -->/location_receiver/<!-- tmpl_var cid -->" measure="cid">[2] \8aÈ\88Õ\88Ê\92u\91ª\92è</a><br />
+ </tmpl_if>
+
<hr />
<a accesskey="8" href="../index">[8] Á¬ÈÙؽÄ</a><br />
<hr />