Index: /applications/editors/josm/plugins/tag2link/resources/tag2link_sources.xml
===================================================================
--- /applications/editors/josm/plugins/tag2link/resources/tag2link_sources.xml	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/resources/tag2link_sources.xml	(revision 26980)
@@ -19,5 +19,5 @@
 <tag2link>
 
-    <!-- Global -->
+    <!-- Global --> 
 
     <source name="Common">
@@ -54,9 +54,9 @@
     </source>
     
-    <!-- Only for France -->
+    <!-- Only for France --> 
     
     <source name="SANDRE" country-code="FR">
         <rule>
-            <condition k="ref:sandre" v="[A-Z0-9-]{8}" />
+            <condition k="ref:(FR:)?sandre" v="[A-Z0-9-]{8}" />
             <link name="View %name% sheet of river" href="http://services.sandre.eaufrance.fr/Courdo/Fiche/client/fiche_courdo.php?CdSandre=%v%" />
         </rule>
@@ -66,10 +66,10 @@
         <rule>
             <condition k="admin_level" v="8"/>
-            <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{3})" id="ref"/>
+            <condition k="ref:(FR:)?INSEE" v="(\p{Digit}{2})(\p{Digit}{3})" id="ref"/>
             <link name="View %name% municipality sheet" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/fichecommunale.asp?codedep=%ref.v.1%&amp;codecom=%ref.v.2%" />
         </rule>
         <rule>
             <condition k="political_division" v="FR:canton"/>
-            <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{2})" id="ref"/>
+            <condition k="ref:(FR:)?INSEE" v="(\p{Digit}{2})(\p{Digit}{2})" id="ref"/>
             <link name="View %name% map of municipalities" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_comcan.asp?codecan=%ref.v%" />
             <link name="View %name% list of municipalities" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/comcan.asp?codedep={ref.v.1}&amp;codecan=%ref.v.2%" />
@@ -77,5 +77,5 @@
         <rule>
             <condition k="admin_level" v="7"/>
-            <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{1})" id="ref"/>
+            <condition k="ref:(FR:)?INSEE" v="(\p{Digit}{2})(\p{Digit}{1})" id="ref"/>
             <link name="View %name% map of cantons" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_canarr.asp?codearr=%ref.v%" />
             <link name="View %name% list of cantons" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/canarr.asp?codedep=%ref.v.1%&amp;codearr=%ref.v.2%" />
@@ -83,5 +83,5 @@
         <rule>
             <condition k="admin_level" v="6"/>
-            <condition k="ref:INSEE" v="\p{Digit}{2}" id="ref"/>
+            <condition k="ref:(FR:)?INSEE" v="\p{Digit}{2}" id="ref"/>
             <link name="View %name% map of arrondissements" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_arrdep.asp?codedep=%ref.v%" />
             <link name="View %name% list of arrondissements" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/arrdep.asp?codedep=%ref.v%" />
@@ -89,5 +89,5 @@
         <rule>
             <condition k="admin_level" v="4"/>
-            <condition k="ref:INSEE" v="\p{Digit}{2}" id="ref"/>
+            <condition k="ref:(FR:)?INSEE" v="\p{Digit}{2}" id="ref"/>
             <link name="View %name% map of departments" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_depreg.asp?codereg=%ref.v%" />
             <link name="View %name% list of departments" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/depreg.asp?codereg=%ref.v%" />
@@ -103,5 +103,5 @@
     <source name="CEF" country-code="FR">
         <rule>
-            <condition k="ref:CEF" v="[A-Z0-9_]{8}" />
+            <condition k="ref:(FR:)?CEF" v="[A-Z0-9_]{8}" />
             <link name="View %name% sheet of church" href="http://www.messesinfo.catholique.fr/public/fiche.php?valcode=%v%" />
         </rule>
@@ -110,10 +110,33 @@
     <source name="MHS" country-code="FR">
         <rule>
-            <condition k="ref:mhs" v="\p{Upper}{2}\p{Digit}{8}" />
+            <condition k="ref:(FR:)?mhs" v="\p{Upper}{2}\p{Digit}{8}" />
             <link name="View Mérimée sheet of monument" href="http://www.culture.gouv.fr/public/mistral/mersri_fr?ACTION=CHERCHER&amp;FIELD_1=REF&amp;VALUE_1=%v%" />
         </rule>
         <rule>
-            <condition k="ref:INSEE" v="\p{Digit}{5}" />
+            <condition k="ref:(FR:)?INSEE" v="\p{Digit}{5}" />
             <link name="View Mérimée list for this municipality" href="http://www.culture.gouv.fr/public/mistral/merimee_fr?ACTION=CHERCHER&amp;FIELD_1=cmer1&amp;VALUE_1=%v%" />
+        </rule>
+    </source>
+
+    <source name="IGN" country-code="FR">
+		<!-- 
+		http://geodesie.ign.fr/fiches/index.php?module=e&action=fichepdf&source=carte&sit_no=4509302&geo_cid=0&lambda=1.90024744&phi=48.03041621
+		 -->
+        <rule>
+            <condition k="man_made" v="survey_point" />
+            <condition k="source" v="©IGN .*" />
+            <condition k="ref" v="(\p{Digit}{7}) - ." id="ref" />
+            <link name="View %name% sheet of geodesic site" href="http://geodesie.ign.fr/fiches/index.php?module=e&amp;action=fichepdf&amp;source=carte&amp;sit_no=%ref.v.1%" />
+            <!-- <link name="View %name% sheet of geodesic site" href="http://geodesie.ign.fr/fiches/index.php?module=e&amp;action=visugeod" method="POST" >
+                <param  name="h_panier"  value="pdf" />
+                <param  name="%ref.v.1%" value="on" />
+                <header name="Content-type" value="application/x-www-form-urlencoded" />
+            </link>-->
+        </rule>
+        <rule>
+            <condition k="site" v="geodesic" />
+            <condition k="source" v="©IGN .*" />
+            <condition k="ref" v="\p{Digit}{7}" id="ref" />
+            <link name="View %name% sheet of geodesic site" href="http://geodesie.ign.fr/fiches/index.php?module=e&amp;action=fichepdf&amp;source=carte&amp;sit_no=%ref.v.1%" />
         </rule>
     </source>
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java	(revision 26980)
@@ -29,4 +29,5 @@
  * @author Don-vip
  * History:
+ * 0.3a 29-Oct-2011 Add Country-code prefix, IGN support + not-yet-tested POST requests support
  * 0.2d 24-Oct-2011 Icon for Mail action
  * 0.2c 24-Oct-2011 Another MHS rule
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java	(revision 26980)
@@ -20,5 +20,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.Locale;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -28,4 +30,5 @@
 import org.openstreetmap.josm.data.osm.Tag;
 import org.openstreetmap.josm.plugins.tag2link.data.Link;
+import org.openstreetmap.josm.plugins.tag2link.data.LinkPost;
 import org.openstreetmap.josm.plugins.tag2link.data.Rule;
 import org.openstreetmap.josm.plugins.tag2link.data.Rule.EvalResult;
@@ -56,68 +59,102 @@
     }
     
+    private static String replaceParams(String s, EvalResult eval) {
+    	String result = s;
+		Matcher m = Pattern.compile("%([^%]*)%").matcher(s);
+		while (m.find()) {
+			String arg = m.group(1);
+			
+			// Search for a standard value
+			String val = findValue(arg, eval.matchingTags);
+			
+			// No standard value found: test lang() function
+			if (val == null) {
+				Matcher lm = Pattern.compile(".*lang(?:\\((\\p{Lower}{2,})(?:,(\\p{Lower}{2,}))*\\))?.*").matcher(arg);
+				if (lm.matches()) {
+					String josmLang = Main.pref.get("language");
+					String jvmLang = (josmLang.isEmpty() ? Locale.getDefault().getLanguage() : josmLang).split("_")[0];
+					if (lm.groupCount() == 0) {
+						val = jvmLang;
+					} else {
+						for (int i = 1; i<=lm.groupCount() && val == null; i++) {
+							if (jvmLang.equals(lm.group(i))) {
+								val = jvmLang;
+							}
+						}
+					}
+				}
+			}
+			
+			// Find a default value if set after ":"
+			if (val == null && arg.contains(":")) {
+				String[] vars = arg.split(":");
+				for (int i = 0; val == null && i < vars.length-1; i++) {
+					val = findValue(vars[i], eval.matchingTags);
+				}
+				if (val == null) {
+					// Default value
+					val = vars[vars.length-1];
+				}
+			}
+			
+			// Has a value been found ?
+			if (val != null) {
+				try {
+					// Special hack for Wikipedia that prevents spaces being replaced by "+" characters, but by "_"
+					if (s.contains("wikipedia.")) {
+						val = val.replaceAll(" ", "_");
+					}
+					// Encode param to be included in the URL, except if it is the URL itself !
+					if (!m.group().equals(s)) {
+						val = URLEncoder.encode(val, UTF8_ENCODING);
+					}
+					// Finally replace parameter
+					result = result.replaceFirst(Pattern.quote(m.group()), val);
+				} catch (UnsupportedEncodingException e) {
+					e.printStackTrace();
+				}
+			} else {
+				System.err.println("Invalid argument: "+arg);
+			}
+		}
+    	return result;
+    }
+    
+    private static void replaceMapParams(Map<String, String> map, EvalResult eval) {
+		for (Iterator<String> it = map.keySet().iterator(); it.hasNext(); ) {
+			String key = it.next();
+			String value = map.get(key);
+			String key2 = replaceParams(key, eval);
+			String value2 = replaceParams(value, eval);
+			if (key.equals(key2) && value.equals(value2)) {
+				// Nothing to do
+			} else if (key.equals(key2)) {
+				// Update value
+				map.put(key, value2);
+			} else {
+				// Update key, and maybe value
+				map.remove(key);
+				map.put(key2, value2);
+			}
+		}
+    }
+    
     private static Collection<Link> processEval(EvalResult eval, Rule rule, Source source) {
     	Collection<Link> result = new ArrayList<Link>();
         if (eval.matches()) {
             for (Link link : rule.links) {
-            	Link copy = new Link(link);
-            	copy.name = copy.name.replaceAll("%name%", source.name);
-				Matcher m = Pattern.compile("%([^%]*)%").matcher(copy.url);
-				while (m.find()) {
-					String arg = m.group(1);
-					
-					// Search for a standard value
-					String val = findValue(arg, eval.matchingTags);
-					
-					// No standard value found: test lang() function
-					if (val == null) {
-						Matcher lm = Pattern.compile(".*lang(?:\\((\\p{Lower}{2,})(?:,(\\p{Lower}{2,}))*\\))?.*").matcher(arg);
-						if (lm.matches()) {
-							String josmLang = Main.pref.get("language");
-							String jvmLang = (josmLang.isEmpty() ? Locale.getDefault().getLanguage() : josmLang).split("_")[0];
-							if (lm.groupCount() == 0) {
-								val = jvmLang;
-							} else {
-								for (int i = 1; i<=lm.groupCount() && val == null; i++) {
-									if (jvmLang.equals(lm.group(i))) {
-										val = jvmLang;
-									}
-								}
-							}
-						}
-					}
-					
-					// Find a default value if set after ":"
-					if (val == null && arg.contains(":")) {
-						String[] vars = arg.split(":");
-						for (int i = 0; val == null && i < vars.length-1; i++) {
-							val = findValue(vars[i], eval.matchingTags);
-						}
-						if (val == null) {
-							// Default value
-							val = vars[vars.length-1];
-						}
-					}
-					
-					// Has a value been found ?
-					if (val != null) {
-						try {
-							// Special hack for Wikipedia that prevents spaces being replaced by "+" characters, but by "_"
-							if (copy.url.contains("wikipedia.")) {
-								val = val.replaceAll(" ", "_");
-							}
-							// Encode param to be included in the URL, except if it is the URL itself !
-							if (!m.group().equals(copy.url)) {
-								val = URLEncoder.encode(val, UTF8_ENCODING);
-							}
-							// Finally replace parameter
-							copy.url = copy.url.replaceFirst(Pattern.quote(m.group()), val);
-						} catch (UnsupportedEncodingException e) {
-							e.printStackTrace();
-						}
-					} else {
-						System.err.println("Invalid argument: "+arg);
-					}
-				}
-            	result.add(copy);
+        		try {
+					Link copy = (Link) link.clone();
+	            	copy.name = copy.name.replaceAll("%name%", source.name);
+	            	copy.url = replaceParams(copy.url, eval);
+	            	if (copy instanceof LinkPost) {
+	            		LinkPost lp = (LinkPost) copy;
+	            		replaceMapParams(lp.headers, eval);
+	            		replaceMapParams(lp.params, eval);
+	            	}
+	            	result.add(copy);
+        		} catch (CloneNotSupportedException e) {
+        			System.err.println(e);
+        		}
             }
         }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java	(revision 26980)
@@ -1,2 +1,17 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package org.openstreetmap.josm.plugins.tag2link.action;
 
@@ -4,8 +19,16 @@
 
 import java.awt.event.ActionEvent;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
 
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.plugins.tag2link.Tag2LinkConstants;
 import org.openstreetmap.josm.plugins.tag2link.data.Link;
+import org.openstreetmap.josm.plugins.tag2link.data.LinkPost;
 import org.openstreetmap.josm.tools.OpenBrowser;
 
@@ -13,15 +36,58 @@
 public class OpenLinkAction extends JosmAction implements Tag2LinkConstants {
 
-    private String url;
+    private Link link;
     
     public OpenLinkAction(Link link) {
         super(tr(link.name), ICON_24, tr("Launch browser with information about the selected object"), null, false);
-        this.url = link.url;
+        this.link = link;
     }
 
     @Override
     public void actionPerformed(ActionEvent e) {
-    	System.out.println("Opening "+url);
-        OpenBrowser.displayUrl(url);
+    	if (link instanceof LinkPost) {
+    		try {
+    			LinkPost lp = (LinkPost) link;
+        		System.out.println("Sending POST request to "+lp.url);
+        		HttpURLConnection conn = (HttpURLConnection) new URL(lp.url).openConnection();
+				conn.setDoOutput(true);
+				conn.setRequestMethod("POST");
+				for (String header : lp.headers.keySet()) {
+					conn.setRequestProperty(header, lp.headers.get(header));
+				}
+				String data = "";
+				for (String param : lp.params.keySet()) {
+					if (!data.isEmpty()) {
+						data += "&";
+					}
+					data += param+"="+lp.params.get(param);
+				}
+				OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());
+				osw.write(data);
+				osw.flush();
+				osw.close();
+				
+				String filename = "output.pdf";// FIXME: should work for PDF files only (not even tested)
+				FileOutputStream fos = new FileOutputStream(filename);
+				InputStream is = conn.getInputStream();
+				byte[] buffer = new byte[2048];
+				int n = -1;
+				while ((n = is.read(buffer)) > -1) {
+					fos.write(buffer, 0, n);
+				}
+				is.close();
+				fos.close();
+				
+		    	System.out.println("Opening "+filename);
+		        OpenBrowser.displayUrl("file://"+filename);
+				
+			} catch (MalformedURLException ex) {
+				ex.printStackTrace();
+			} catch (IOException ex) {
+				ex.printStackTrace();
+			}
+    	} else {
+	    	System.out.println("Opening "+link.url);
+	        OpenBrowser.displayUrl(link.url);
+    	}
     }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenMailAction.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenMailAction.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenMailAction.java	(revision 26980)
@@ -1,2 +1,17 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package org.openstreetmap.josm.plugins.tag2link.action;
 
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Condition.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Condition.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Condition.java	(revision 26980)
@@ -1,2 +1,17 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package org.openstreetmap.josm.plugins.tag2link.data;
 
@@ -7,3 +22,14 @@
     public Pattern valPattern;
     public String id;
+    
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Condition ["
+				+ (keyPattern != null ? "k=" + keyPattern + ", " : "")
+				+ (valPattern != null ? "v=" + valPattern + ", " : "")
+				+ (id != null ? "id=" + id : "") + "]";
+	}
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Link.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Link.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Link.java	(revision 26980)
@@ -1,5 +1,20 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package org.openstreetmap.josm.plugins.tag2link.data;
 
-public class Link {
+public class Link implements Cloneable {
     public String name;
     public String url;
@@ -11,16 +26,16 @@
     
     public Link(Link link) {
-    	this(link.name, link.url);
+    	this(new String(link.name), new String(link.url));
     }
     
-    private boolean containsParams(String s) {
+    protected final boolean containsParams(String s) {
         return s.matches("[^{}]*{[^{}]*}[^{}]*");
     }
     
-    public boolean nameContainsParams() {
+    public final boolean nameContainsParams() {
         return containsParams(name);
     }
     
-    public boolean urlContainsParams() {
+    public final boolean urlContainsParams() {
         return containsParams(url);
     }
@@ -29,3 +44,19 @@
         return nameContainsParams() || urlContainsParams();
     }
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Link [name=" + name + ", url=" + url + "]";
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#clone()
+	 */
+	@Override
+	public Link clone() throws CloneNotSupportedException {
+		return new Link(this);
+	}
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java	(revision 26980)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java	(revision 26980)
@@ -0,0 +1,76 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.tag2link.data;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class LinkPost extends Link {
+
+	public final Map<String, String> headers;
+	public final Map<String, String> params;
+	
+	public LinkPost(LinkPost link) {
+		this(new String(link.name), new String(link.url), 
+				link.headers == null ? null : new HashMap<String, String>(link.headers), 
+				link.params  == null ? null : new HashMap<String, String>(link.params));
+	}
+
+	public LinkPost(String name, String url) {
+		this(name, url, null, null);
+	}
+
+	public LinkPost(String name, String url, Map<String, String> headers, Map<String, String> params) {
+		super(name, url);
+		this.headers = headers;
+		this.params = params;
+	}
+	
+	protected final boolean containsParams(Map<String, String> map) {
+		if (map != null) {
+			for (String key : map.keySet()) {
+				if (containsParams(map.get(key))) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+	
+	public boolean headersContainsParams() {
+		return containsParams(headers);
+	}
+
+	public boolean paramsContainsParams() {
+		return containsParams(params);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.openstreetmap.josm.plugins.tag2link.data.Link#containsParams()
+	 */
+	@Override
+	public boolean containsParams() {
+		return super.containsParams() || headersContainsParams() || paramsContainsParams();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.openstreetmap.josm.plugins.tag2link.data.Link#clone()
+	 */
+	@Override
+	public LinkPost clone() throws CloneNotSupportedException {
+		return new LinkPost(this);
+	}
+}
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java	(revision 26980)
@@ -1,2 +1,17 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package org.openstreetmap.josm.plugins.tag2link.data;
 
@@ -39,15 +54,37 @@
         	}
         }
+		/* (non-Javadoc)
+		 * @see java.lang.Object#toString()
+		 */
+		@Override
+		public String toString() {
+			return "MatchingTag [" + (key != null ? "key=" + key + ", " : "")
+					+ (value != null ? "value=" + value + ", " : "")
+					+ (params != null ? "params=" + params + ", " : "")
+					+ (prefix != null ? "prefix=" + prefix : "") + "]";
+		}
     }
     
     public static class EvalResult {
+    	private final int conditionsNumber;
+    	public EvalResult(int conditionsNumber) {
+    		this.conditionsNumber = conditionsNumber;
+    	}
         public final Collection<MatchingTag> matchingTags = new ArrayList<MatchingTag>();
         public boolean matches() {
-            return !matchingTags.isEmpty();
+            return conditionsNumber > 0 && matchingTags.size() >= conditionsNumber;
         }
+		/* (non-Javadoc)
+		 * @see java.lang.Object#toString()
+		 */
+		@Override
+		public String toString() {
+			return "EvalResult [conditionsNumber=" + conditionsNumber
+					+ ", matchingTags=" + matchingTags + "]";
+		}
     }
     
     public EvalResult evaluates(Map<String, String> tags) {
-        EvalResult result = new EvalResult();
+        EvalResult result = new EvalResult(conditions.size());
         for (Condition c : conditions) {
             for (String key : tags.keySet()) {
@@ -73,5 +110,4 @@
         }
         return result;
-
     }
     
@@ -85,3 +121,11 @@
 		return evaluates(map);
 	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Rule [conditions=" + conditions + ", links=" + links + "]";
+	}
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java	(revision 26980)
@@ -1,2 +1,17 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package org.openstreetmap.josm.plugins.tag2link.data;
 
@@ -11,3 +26,11 @@
 		this.name = name;
 	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Source [name=" + name + ", rules=" + rules + "]";
+	}
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java	(revision 26979)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java	(revision 26980)
@@ -1,2 +1,17 @@
+//    JOSM tag2link plugin.
+//    Copyright (C) 2011 Don-vip & FrViPofm
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package org.openstreetmap.josm.plugins.tag2link.io;
 
@@ -8,5 +23,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.regex.Pattern;
 
@@ -21,4 +38,5 @@
 import org.openstreetmap.josm.plugins.tag2link.data.Condition;
 import org.openstreetmap.josm.plugins.tag2link.data.Link;
+import org.openstreetmap.josm.plugins.tag2link.data.LinkPost;
 import org.openstreetmap.josm.plugins.tag2link.data.Rule;
 import org.openstreetmap.josm.plugins.tag2link.data.Source;
@@ -174,9 +192,38 @@
 
     private Link parseLink() throws XMLStreamException {
-        Link link = new Link(
-	        parser.getAttributeValue(null, "name"),
-	        parser.getAttributeValue(null, "href")
-        );
-        jumpToEnd();
+        Link link = null;
+        String name = parser.getAttributeValue(null, "name");
+        String href = parser.getAttributeValue(null, "href");
+        
+        if ("POST".equals(parser.getAttributeValue(null, "method"))) {
+        	Map<String, String> headers = null;
+        	Map<String, String> params = null;
+        	while (parser.hasNext()) {
+                int event = parser.next();
+                if (event == XMLStreamConstants.START_ELEMENT) {
+                    if (parser.getLocalName().equals("header")) {
+                        if (headers == null) {
+                        	headers = new HashMap<String, String>();
+                        }
+                        headers.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value"));
+                    } else if (parser.getLocalName().equals("param")) {
+                        if (params == null) {
+                        	params = new HashMap<String, String>();
+                        }
+                        params.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value"));
+                    } else {
+                        parseUnknown();
+                    }
+                } else if (event == XMLStreamConstants.END_ELEMENT) {
+                    if (parser.getLocalName().equals("link")) {
+                    	break;
+                    }
+                }
+            }
+        	link = new LinkPost(name, href, headers, params);
+        } else {
+	        link = new Link(name, href);
+	        jumpToEnd();
+        }
         return link;
     }
