package com.perm.kate.api;

import java.net.URLEncoder;
import java.util.TreeMap;
import java.util.Map.Entry;

public class Params {
    TreeMap<String, String> args = new TreeMap<String, String>();
    String method_name;
    
    public Params(String method_name){
        this.method_name=method_name;
    }

    public void put(String param_name, String param_value) {
        if(param_value==null || param_value.length()==0)
            return;
        args.put(param_name, param_value);
    }
    
    public void put(String param_name, Long param_value) {
        if(param_value==null)
            return;
        args.put(param_name, Long.toString(param_value));
    }
    
    public void put(String param_name, Integer param_value) {
        if(param_value==null)
            return;
        args.put(param_name, Integer.toString(param_value));
    }
    
    public void putDouble(String param_name, double param_value) {
        args.put(param_name, Double.toString(param_value));
    }
    
    public String getParamsString() {
        String params="";
        for(Entry<String, String> entry:args.entrySet()){
            if(params.length()!=0)
                params+="&";
            params+=(entry.getKey()+"="+URLEncoder.encode(entry.getValue()));
        }
        return params;
    }

}

@@ -23,16 +23,62 @@
 api;%0D%0A%0D%0A
+import java.io.UnsupportedEncodingException;%0D%0A
 import j
@@ -1141,24 +1141,43 @@
 params=%22%22;%0D%0A
+        try %7B%0D%0A    
         for(
@@ -1227,32 +1227,36 @@
 )%7B%0D%0A            
+    
 if(params.length
@@ -1259,24 +1259,28 @@
 ngth()!=0)%0D%0A
+    
             
@@ -1301,32 +1301,36 @@
 %22;%0D%0A            
+    
 params+=(entry.g
@@ -1375,17 +1375,127 @@
 tValue()
-)
+, %22utf-8%22));%0D%0A            %7D%0D%0A        %7D catch (UnsupportedEncodingException e) %7B%0D%0A            e.printStackTrace(
 );%0D%0A    

Fix posting messages with smiles