OSDN Git Service

replace prefectures to link to Mobile Google Map
authormorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Mon, 14 Jan 2008 05:22:44 +0000 (05:22 +0000)
committermorimoto <morimoto@180c8125-5b33-4295-ad04-72a68a15b4cc>
Mon, 14 Jan 2008 05:22:44 +0000 (05:22 +0000)
replace special wards and cities in Tokyo to link to Mobile Google Map

lib/plugins/30prefectures [new file with mode: 0644]
lib/plugins/31distinct [new file with mode: 0644]

diff --git a/lib/plugins/30prefectures b/lib/plugins/30prefectures
new file mode 100644 (file)
index 0000000..8e913a6
--- /dev/null
@@ -0,0 +1,24 @@
+# -*-perl-*-
+# keitairc/lib/plugins/30prefectures
+# 
+# ¸©Ì¾¤«¤é»Ï¤Þ¤ëʸ»úÎó¤ò·ÈÂÓÈÇGoogle Map¤Ë¥ê¥ó¥¯
+# $Id: 30prefectures,v 1.1 2008-01-14 05:22:44 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/30prefectures,v $
+
+$plugin = {
+       name => 'prefectures',
+
+       message_replace_regexp => '(Ë̳¤Æ»|µþÅÔÉÜ|ÂçºåÉÜ|ÅìµþÅÔ|ÀÄ¿¹¸©|´ä¼ê¸©|µÜ¾ë¸©|½©Åĸ©|»³·Á¸©|Ê¡Å縩|°ñ¾ë¸©|ÆÊÌÚ¸©|·²Çϸ©|ºë¶Ì¸©|ÀéÍÕ¸©|¿ÀÆàÀ|¿·³ã¸©|ÉÙ»³¸©|ÀÐÀ|Ê¡°æ¸©|»³Íü¸©|ĹÌ|´ôÉ츩|ÀŲ¬¸©|°¦Ãθ©|»°½Å¸©|¼¢²ì¸©|ʼ¸Ë¸©|ÆàÎɸ©|Ï²λ³¸©|Ä»¼è¸©|Å纬¸©|²¬»³¸©|¹­Å縩|»³¸ý¸©|ÆÁÅ縩|¹áÀ|°¦É²¸©|¹âÃθ©|Ê¡²¬¸©|º´²ì¸©|Ĺºê¸©|·§Ëܸ©|Âçʬ¸©|µÜºê¸©|¼¯»ùÅ縩|²­Æ츩)(.*)',
+       message_replace_imprementation => sub {
+               my ($session_id, $p1, $p2) = @_;
+               my $str = $p1 . $p2;
+               my $tmp = $str;
+               Encode::from_to($tmp, 'euc-jp', 'shiftjis');
+               my $tmp = ::uri_escape($tmp);
+               sprintf('<a href="http://www.google.co.jp/m/lcb?mp=1&uipref=3&source=m&ie=Shift_JIS&action=chgloc&loc=%s">%s</a>', $tmp, $str);
+       },
+};
+
+1;
+
+
diff --git a/lib/plugins/31distinct b/lib/plugins/31distinct
new file mode 100644 (file)
index 0000000..35e4bd9
--- /dev/null
@@ -0,0 +1,29 @@
+# -*-perl-*-
+# keitairc/lib/plugins/31distinct
+# 
+# ¶è̾¤«¤é»Ï¤Þ¤ëʸ»úÎó¤ò·ÈÂÓÈÇGoogle Map¤Ë¥ê¥ó¥¯
+# TODO: ÅìµþÅԤζ褷¤«¤Ï¤¤¤Ã¤Æ¤Ê¤¤¤è
+# $Id: 31distinct,v 1.1 2008-01-14 05:22:44 morimoto Exp $
+# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/31distinct,v $
+
+
+my $tokyo_special_wards = 'ÀéÂåÅĶè|Ãæ±û¶è|¹Á¶è|¿·½É¶è|ʸµþ¶è|ÂæÅì¶è|ËÏÅĶè|¹¾Åì¶è|ÉÊÀî¶è|Ìܹõ¶è|ÂçÅĶè|À¤ÅÄë¶è|½Âë¶è|ÃæÌî¶è|¿ùʶè|Ë­Åç¶è|Ë̶è|¹ÓÀî¶è|ÈĶ¶¶è|ÎýÇ϶è|­Ω¶è|³ë¾þ¶è|¹¾¸ÍÀî¶è';
+my $tokyo_cities = '¾¼Åç»Ô|¤¢¤­¤ëÌî»Ô|°ð¾ë»Ô|ÀÄÇß»Ô|À¶À¥»Ô|¹ñΩ»Ô|¾®¶â°æ»Ô|¹ñʬ»û»Ô|¾®Ê¿»Ô|¹ý¹¾»Ô|ΩÀî»Ô|¿Ëà»Ô|Ä´ÉÛ»Ô|À¾Åìµþ»Ô|Ȭ²¦»Ò»Ô|±©Â¼»Ô|Åìµ×αÊÆ»Ô|Åì¼»³»Ô|ÅìÂçÏ»Ô|ÆüÌî»Ô|ÉÜÃæ»Ô|Ê¡À¸»Ô|Ä®ÅÄ»Ô|»°Âë»Ô|Éð¢Ìî»Ô|É𢼻³»Ô';
+
+$plugin = {
+       name => 'distinct',
+
+       message_replace_regexp => '(' . $tokyo_special_wards . '|' . $tokyo_cities . ')(.*)',
+       message_replace_imprementation => sub {
+               my ($session_id, $p1, $p2) = @_;
+               my $str = $p1 . $p2;
+               my $tmp = $str;
+               Encode::from_to($tmp, 'euc-jp', 'shiftjis');
+               my $tmp = ::uri_escape($tmp);
+               sprintf('<a href="http://www.google.co.jp/m/lcb?mp=1&uipref=3&source=m&ie=Shift_JIS&action=chgloc&loc=%s">%s</a>', $tmp, $str);
+       },
+};
+
+1;
+
+