Imported Upstream version 0.2.10
[debian/pino.git] / src / rest_api_re.vala
index bbb7811..7448a6c 100644 (file)
@@ -44,7 +44,7 @@ public class RestAPIRe : RestAPIAbstract {
                
                string req_url = urls.direct_new();
                
-               var map = new HashTable<string, string>(null, null);
+               var map = new HashTable<string, string>(str_hash, str_equal);
                map.insert("screen_name", user);
                map.insert("text", text);
                
@@ -63,7 +63,7 @@ public class RestAPIRe : RestAPIAbstract {
                
                string req_url = urls.status_update();
                
-               var map = new HashTable<string, string>(null, null);
+               var map = new HashTable<string, string>(str_hash, str_equal);
                map.insert("status", text);
                
                if(account != null && account.service == "identi.ca") //client name for identi.ca
@@ -73,13 +73,18 @@ public class RestAPIRe : RestAPIAbstract {
                        map.insert("in_reply_to_status_id", reply_id);
                
                string data = make_request(req_url, "POST", map);
-               
-               return parse_status(data);
+
+               var result = parse_status(data);
+
+               return result;
        }
        
-       private Status parse_status(string data) {
+       private Status parse_status(string data) throws ParseError {
                Status status = new Status();
                Xml.Doc* xmlDoc = Parser.parse_memory(data, (int)data.size());
+               if(xmlDoc == null)
+                       throw new ParseError.CODE("Invalid XML data");
+               
                Xml.Node* rootNode = xmlDoc->get_root_element();
                string result = "";
                
@@ -99,6 +104,7 @@ public class RestAPIRe : RestAPIAbstract {
                                
                                case "created_at":
                                        status.created_at = str_to_time(iter->get_content());
+                                       status.created_at_s = iter->get_content();
                                        break;
                                
                                case "text":