- error = json_object_object_get(content, "error");
- if (error) {
- fprintf(stderr, "Login failed\n");
- return ;
+ return v;
+}
+
+char *ws_login()
+{
+ struct json_object *rq, *rp, *j;
+ char *str;
+
+ rq = ws_request_new("login");
+ ws_request_add_att_str(rq, "user", session_user);
+ ws_request_add_att_str(rq, "password", session_pwd);
+
+ rp = ws_execute(rq);
+ json_object_put(rq);
+
+ if (rp) {
+ j = json_object_object_get(rp, "session_id");
+
+ if (j)
+ str = strdup(json_object_get_string(j));
+ else
+ str = NULL;
+
+ json_object_put(rp);
+ } else {
+ str = NULL;