Ejemplo n.º 1
0
static void upload_offline_file_init(PurpleXfer* xfer)
{
	qq_account* ac = purple_connection_get_protocol_data(purple_account_get_connection(xfer->account));
	LwqqClient* lc = ac->qq;

	const char* serv_id;
	if(ac->flag&QQ_USE_QQNUM){
		const char* qqnum = purple_xfer_get_remote_user(xfer);
		LwqqBuddy* b = find_buddy_by_qqnumber(ac->qq, qqnum);
		if(b == NULL) return;
		serv_id = b->uin;
	}else{
		serv_id = purple_xfer_get_remote_user(xfer);
	}

	LwqqMsgOffFile* file = lwqq_msg_fill_upload_offline_file(
			xfer->local_filename, lc->myself->uin, serv_id);
	xfer->start_time = time(NULL);
	xfer->data = file;
	int flags = 0;
	if(ac->flag&QQ_DONT_EXPECT_100_CONTINUE) flags |= DONT_EXPECTED_100_CONTINUE;
	LwqqAsyncEvent* ev = lwqq_msg_upload_offline_file(lc,file,flags);
	lwqq_async_add_event_listener(ev,_C_(2p,send_file,ev,xfer));
	LwqqHttpRequest* req = lwqq_async_event_get_conn(ev);
	lwqq_http_on_progress(req, file_trans_on_progress, xfer);
	lwqq_http_set_option(req, LWQQ_HTTP_CANCELABLE,1L);
}
Ejemplo n.º 2
0
void qq_send_offline_file(PurpleBlistNode* node)
{
    PurpleBuddy* buddy = PURPLE_BUDDY(node);
    PurpleAccount* account = purple_buddy_get_account(buddy);
    qq_account* ac = purple_connection_get_protocol_data(
                         purple_account_get_connection(account));
    const char* who;
    if(ac->qq_use_qqnum){
        const char* qqnum = purple_buddy_get_name(buddy);
        LwqqBuddy* b = find_buddy_by_qqnumber(ac->qq, qqnum);
        if(b == NULL) return;
        who = b->uin;
    }else{
        who = purple_buddy_get_name(buddy);
    }
    PurpleXfer* xfer = purple_xfer_new(account,PURPLE_XFER_SEND,who);
    purple_xfer_set_init_fnc(xfer,upload_offline_file_init);
    purple_xfer_set_request_denied_fnc(xfer,recv_file_request_denied);
    purple_xfer_set_cancel_send_fnc(xfer,recv_file_cancel);
    purple_xfer_request(xfer);
}