Dabr - Reply to all and Geotagging

People have been very excited to see some new functionality in Dabr - the mobile Twitter client I develop for. But what is it and how does it work?

@@ and geotag

@@ and geotag

Reply to All

The @@ symbol allows you to reply to all the people mentioned within the tweet.
It only shows up on tweets which mention other users - so you should only ever see it when it can be used.

Hitting @@ on the above tweet will pre-populate the text box with "@topgold @whatleydude @dabr".

It should remove any duplicates and should also remove your username.

Geotagging

Twitter recently allowed the geotagging of tweets. This allows you to set the longitude and latitude of where you are when you wrote your message.
Clicking on the green globe (it just looks like a dot at that size!) takes you to a mobile mapping service.

Google Maps Mobile

Google Maps Mobile

It only shows up on tweets which are geotagged - so you should only ever see it when it can be used.

How Does It Work?

You can see all the code in the SVN, but here's a quick rundown.

Geotagging is very simple.  Statuses now have a <geo> field.  If this is populated, it will contain a longitude and latitude.

We can take those values and pass them to Google Maps Mobile (or your favourite mobile mapping service).
if ($geo !== null)
{
   $latlong = $geo->coordinates;
   $lat = $latlong[0];
   $long = $latlong[1];
   $actions[] = theme('action_icon', "http://maps.google.co.uk/m?q={$lat},{$long}", 'images/map.png', 'MAP');
}

Reply to all is a little more involved.
Twitter provide an excellent set of Text Libraries. These provide officially sanctioned regular expressions to help your project find URLs, hashtags and usernames.

Using the Twitter Text Extractor class we can determine how many usernames are mentioned in a tweet. Any duplicates are removed - as is the user's username.

Any questions - just ask!


One Response to “Dabr - Reply to all and Geotagging”

What Do You Reckon?