Ejemplo n.º 1
0
static void recv_file_cancel(PurpleXfer* xfer)
{
	LwqqMsg* msg = xfer->data;
	if(!msg) return;
	if(lwqq_mt_bits(msg->type)==LWQQ_MT_FILE_MSG){
		LwqqMsgFileMessage* file = (LwqqMsgFileMessage*)msg;
		lwqq_http_cancel(file->req);
		lwqq_msg_free((LwqqMsg*)file);
	}else if(lwqq_mt_bits(msg->type)==LWQQ_MT_OFFFILE){
		LwqqMsgOffFile* file = (LwqqMsgOffFile*)msg;
		lwqq_http_cancel(file->req);
		lwqq_msg_free((LwqqMsg*)file);
	}else{
		lwqq_log(LOG_ERROR,"msg file cast failed");
	}
}
Ejemplo n.º 2
0
static void recv_file_request_denied(PurpleXfer* xfer)
{
	qq_account* ac = purple_connection_get_protocol_data(purple_account_get_connection(xfer->account));
	LwqqClient* lc = ac->qq;
	LwqqMsgFileMessage* file = xfer->data;
	lwqq_msg_refuse_file(lc, file);
	lwqq_msg_free((LwqqMsg*)file);
}
Ejemplo n.º 3
0
static void send_file(LwqqAsyncEvent* event,PurpleXfer *xfer)
{
    //now xfer is not valid.
    if(event->failcode != LWQQ_CALLBACK_VALID) return;
    qq_account* ac = purple_connection_get_protocol_data(purple_account_get_connection(xfer->account));
    LwqqClient* lc = ac->qq;
    long errno = 0;
    if(event->failcode==LWQQ_CALLBACK_FAILED) {
        lwqq_msg_free((LwqqMsg*)xfer->data);
        return;
    }
    errno = lwqq_async_event_get_result(event);
    LwqqMsgOffFile* file = xfer->data;
    if(errno) {
        qq_sys_msg_write(ac,LWQQ_MS_BUDDY_MSG, file->super.to,"发送离线文件失败",PURPLE_MESSAGE_ERROR,time(NULL));
        lwqq_msg_free((LwqqMsg*)file);
        purple_xfer_set_completed(xfer,1);
    } else {
        LwqqAsyncEvent* ev = lwqq_msg_send_offfile(lc,file);
        lwqq_async_add_event_listener(ev,_C_(2p,send_offline_file_receipt,ev,xfer));
    }
}
Ejemplo n.º 4
0
static void send_offline_file_receipt(LwqqAsyncEvent* ev,PurpleXfer* xfer)
{
	int err = lwqq_async_event_get_result(ev);
	qq_account* ac = purple_connection_get_protocol_data(purple_account_get_connection(xfer->account));
	LwqqMsgOffFile* file = xfer->data;

	if(err == 0){
		qq_sys_msg_write(ac, LWQQ_MS_BUDDY_MSG, file->super.to, _("Send offline file successful"), PURPLE_MESSAGE_SYSTEM, time(NULL));
	}else{
		char buf[512];
		snprintf(buf,sizeof(buf),_("Send offline file failed,Error Code:%d"),err);
		qq_sys_msg_write(ac, LWQQ_MS_BUDDY_MSG, file->super.to, buf, PURPLE_MESSAGE_ERROR, time(NULL));
	}
	lwqq_msg_free((LwqqMsg*)file);
	purple_xfer_set_completed(xfer,1);
}
Ejemplo n.º 5
0
static void recv_file_complete(PurpleXfer* xfer,LwqqAsyncEvent* ev)
{
	if(ev->failcode == LWQQ_CALLBACK_CANCELED) return;
	qq_account* ac = purple_connection_get_protocol_data(purple_account_get_connection(xfer->account));
	LwqqMsgFileMessage* file = xfer->data;
	char buf[512];
	const char* extra = NULL;
	if(ev->result){
		snprintf(buf,sizeof(buf),_("Transport Failed,Error Code:%d\n"),ev->result);
		if(ev->result == 102)
			extra = _("Other may send via webqq.\nPlease call him send via email or offline file.");
		else extra = NULL;
		purple_notify_error(ac->gc,_("File Transport"),buf,extra);
	}
	purple_xfer_set_completed(xfer,1);
	lwqq_msg_free((LwqqMsg*)file);
}
Ejemplo n.º 6
0
static void recv_file_complete(PurpleXfer* xfer,LwqqAsyncEvent* ev)
{
    if(ev->failcode == LWQQ_CALLBACK_CANCELED) return;
    qq_account* ac = purple_connection_get_protocol_data(purple_account_get_connection(xfer->account));
    LwqqMsgFileMessage* file = xfer->data;
    char buf[512];
    const char* extra = NULL;
    if(ev->result) {
        snprintf(buf,sizeof(buf),"传输失败,错误号:%d\n",ev->result);
        if(ev->result == 102)
            extra = "对方是用webqq发送的吧.\n让对方发离线文件或邮件吧.";
        else extra = NULL;
        purple_notify_error(ac->gc,"文件传输",buf,extra);
    }
    purple_xfer_set_completed(xfer,1);
    lwqq_msg_free((LwqqMsg*)file);
}