Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mrDoctorWho/vk4xmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrDoctorWho <mrdoctorwho@gmail.com>2013-09-28 01:03:17 +0400
committermrDoctorWho <mrdoctorwho@gmail.com>2013-09-28 01:03:17 +0400
commitb71f78bb5ed98b57d906d8bed1529e6502df6817 (patch)
treecbd3e049a035c566d14ccfcf45be7386d504a830 /extensions
parent59dd856b12784ec5cf92456a013d6495108c06d2 (diff)
readme update, geo add
Diffstat (limited to 'extensions')
-rw-r--r--extensions/geo.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/extensions/geo.py b/extensions/geo.py
new file mode 100644
index 0000000..d8cdaea
--- /dev/null
+++ b/extensions/geo.py
@@ -0,0 +1,23 @@
+# coding: utf
+# This file is a part of VK4XMPP transport
+# © simpleApps, 2013.
+
+import urllib
+
+GoogleMapLink = "https://maps.google.com/maps?q=%s"
+
+def TimeAndDimensionInSpace(self, machine):
+ body = str()
+ if machine.has_key("geo"):
+ WhereAreYou = machine["geo"]
+ Place = WhereAreYou["place"]
+ Coordinates = WhereAreYou["coordinates"].split()
+ Coordinates = "Lat.: {0}°, long: {1}°".format(*Coordinates)
+ body = _("Point on the map: \n")
+ body += _("Country: %s") % Place["country"]
+ body += _("\nCity: %s") % Place["city"]
+ body += _("\nCoordinates: %s") % Coordinates
+ body += "\n%s — Google Maps" % GoogleMapLink % urllib.quote(WhereAreYou["coordinates"])
+ return body
+
+Handlers["msg01"].append(TimeAndDimensionInSpace) \ No newline at end of file