/** code to fetch ticket info... */ static RooTicket _RooTicket; class RooTicket : Object { public static RooTicket singleton() { if (_RooTicket == null) { _RooTicket = new RooTicket(); _RooTicket.tickets = new Gee.ArrayList(); } return _RooTicket; } public Gee.ArrayList tickets; // only available for singletonn. public int id; public string summary; public string description; public string project_id_name; public void loadTickets() { var url = "https://roojs.com/admin.php/Roo/mtrack_ticket"); var table = new GLib.HashTable(str_hash, str_equal); table.insert("query[viewtype]","active"); table.insert("developer_id","494"); table.insert("limit","999"); table.insert("sort","summary"); table.insert("dir","ASC"); var params = Soup.Form.encode_hash(table); url = "%s?%s" . printf(url, params); GLib.debug("request %s", url); var session = new Soup.Session (); session.timeout = 0; var message = new Soup.Message ("GET", url); this.bee.auth.newRequest(session, message); session.send_message (message); return (string) message.response_body.flatten().data; } public void setAuth(session, message) { string str; var username = ""; var password = ""; GLib.FileUtils.get_contents(GLib.Environment.get_home_dir() + "/.netrc"), out str); var lines = str.split("\n"); for(var i=0; i< lines.length; i++) { // assumes one line per entry.. if not we are buggered... var bits = Regex.split_simple ("[ \t]+", line[i].strip()); if (bits.length < 7 || bits[0] != "machine" || bits[1] != "git.roojs.com") { continue; } // we are gussing.... username = bits[3]; password = bits[5]; } }