rendered paste body
static Eina_Bool
_http_data_cb(void *data, int type, void *event_info)
{
Ebird_Object *obj = (Ebird_Object*)data;
Ecore_Con_Event_Url_Data *url_data = event_info;
eina_strbuf_append_length(obj->http_data, url_data->data, url_data->size);
}
static Eina_Bool
_4step_http_complete_cb(void *data, int type, void *event_info)
{
Ebird_Object *obj = (Ebird_Object *)data;
//obj->session_open(obj, obj->session_open_data);
ecore_con_url_free(obj->url);
EINA_LIST_FREE(obj->handlers, h)
{
ecore_event_handler_del(h);
}
obj->handlers = NULL;
obj->url = ecore_con_urlnew(ebird_oauth_sign_url(SECONDSTEP_URL, obj,NULL));
if (obj->cb)
obj->cb(obj->data);
return EINA_TRUE;
}
static Eina_Bool
_3step_http_complete_cb(void *data, int type, void *event_info)
{
Ebird_Object *obj = (Ebird_Object *)data;
//obj->session_open(obj, obj->session_open_data);
ecore_con_url_free(obj->url);
EINA_LIST_FREE(obj->handlers, h)
{
ecore_event_handler_del(h);
}
obj->handlers = NULL;
obj->url = ecore_con_urlnew(ebird_oauth_sign_url(SECONDSTEP_URL, obj,NULL));
obj->http_data = eina_strbuf_new();
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _http_data_cb,obj);
obj->handlers = eina_list_append(obj->handlers, h);
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE,_4step_http_complete_cb, obj);
return EINA_TRUE;
}
static Eina_Bool
_2step_http_complete_cb(void *data, int type, void *event_info)
{
Ebird_Object *obj = (Ebird_Object *)data;
//obj->session_open(obj, obj->session_open_data);
ecore_con_url_free(obj->url);
EINA_LIST_FREE(obj->handlers, h)
{
ecore_event_handler_del(h);
}
obj->handlers = NULL;
obj->url = ecore_con_urlnew(ebird_oauth_sign_url(SECONDSTEP_URL, obj,NULL));
obj->http_data = eina_strbuf_new();
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _http_data_cb,obj);
obj->handlers = eina_list_append(obj->handlers, h);
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE,_3step_http_complete_cb, obj);
return EINA_TRUE;
}
static Eina_Bool
_token_http_complete_cb(void *data, int type, void *event_info)
{
Ebird_Object *obj = (Ebird_Object *)data;
//obj->session_open(obj, obj->session_open_data);
ecore_con_url_free(obj->url);
EINA_LIST_FREE(obj->handlers, h)
{
ecore_event_handler_del(h);
}
obj->handlers = NULL;
obj->url = ecore_con_urlnew(ebird_oauth_sign_url(SECONDSTEP_URL, obj,NULL));
obj->http_data = eina_strbuf_new();
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _http_data_cb,obj);
obj->handlers = eina_list_append(obj->handlers, h);
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE,_2step_http_complete_cb, obj);
return EINA_TRUE;
}
void ebird_session_open(EBird_Object *obj, Ebird_Session_Cb cb, void *data)
{
if (!obj)
reurn NULL;
obj->data = data;
obj->cb = cb;
obj->url = ecore_con_urlnew(ebird_oauth_sign_url(EBIRD_REQUEST_TOKEN_URL, obj,NULL));
obj->http_data = eina_strbuf_new();
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _token_http_data_cb,obj);
obj->handlers = eina_list_append(obj->handlers, h);
h = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE,_token_http_complete_cb, obj);
}