예제 #1
0
파일: ft.c 프로젝트: lawm/pidgin-lwqq
void file_message(LwqqClient* lc,LwqqMsgFileMessage* file)
{
    qq_account* ac = lwqq_client_userdata(lc);
    if(file->mode == MODE_RECV) {
        PurpleAccount* account = ac->account;
        LwqqClient* lc = ac->qq;
        //for(i=0;i<file->file_count;i++){
        LwqqBuddy* buddy = lc->find_buddy_by_uin(lc,file->from);
        if(buddy == NULL ) return;
        const char* key = try_get(buddy->qqnumber,buddy->uin);
        PurpleXfer* xfer = purple_xfer_new(account,PURPLE_XFER_RECEIVE,key);
        purple_xfer_set_filename(xfer,file->recv.name);
        purple_xfer_set_init_fnc(xfer,recv_file_init);
        purple_xfer_set_request_denied_fnc(xfer,recv_file_request_denied);
        purple_xfer_set_cancel_recv_fnc(xfer,recv_file_cancel);
        LwqqMsgFileMessage* fdup = s_malloc(sizeof(*fdup));
        memcpy(fdup,file,sizeof(*fdup));
        file->from = file->to = file->reply_ip = file->recv.name = NULL;
        xfer->data = fdup;
        purple_xfer_request(xfer);
    } else if(file->mode == MODE_REFUSE) {
        if(file->refuse.cancel_type == CANCEL_BY_USER) {
            qq_sys_msg_write(ac, LWQQ_MT_BUDDY_MSG, file->from, "对方取消文件传输", PURPLE_MESSAGE_SYSTEM, time(NULL));
        } else if(file->refuse.cancel_type == CANCEL_BY_OVERTIME) {
            qq_sys_msg_write(ac, LWQQ_MT_BUDDY_MSG, file->from, "文件传输超时", PURPLE_MESSAGE_SYSTEM, time(NULL));
        }

    }

}
예제 #2
0
파일: ft.c 프로젝트: 5rather/pidgin-lwqq
//the entrience for recv file messages
void file_message(LwqqClient* lc,LwqqMsgFileMessage* file)
{
	qq_account* ac = lwqq_client_userdata(lc);
	if(file->mode == MODE_RECV) {
		PurpleAccount* account = ac->account;
		LwqqClient* lc = ac->qq;
		LwqqBuddy* buddy = lc->find_buddy_by_uin(lc,file->super.from);
		if(buddy == NULL ) return;
		const char* key = try_get(buddy->qqnumber,buddy->uin);
		PurpleXfer* xfer = purple_xfer_new(account,PURPLE_XFER_RECEIVE,key);
		purple_xfer_set_filename(xfer,file->recv.name);
		purple_xfer_set_init_fnc(xfer,recv_file_init);
		purple_xfer_set_request_denied_fnc(xfer,recv_file_request_denied);
		purple_xfer_set_cancel_recv_fnc(xfer,recv_file_cancel);
		LwqqMsgFileMessage* fdup = s_malloc0(sizeof(*fdup));
		lwqq_msg_move(fdup,file);
		xfer->data = fdup;
		purple_xfer_request(xfer);
	} else if(file->mode == MODE_REFUSE) {
		if(file->refuse.cancel_type == CANCEL_BY_USER) 
			qq_sys_msg_write(ac, LWQQ_MS_BUDDY_MSG, file->super.from, 
					_("Other canceled file transport"), 
					PURPLE_MESSAGE_SYSTEM, 
					time(NULL));
		else if(file->refuse.cancel_type == CANCEL_BY_OVERTIME) 
			qq_sys_msg_write(ac, LWQQ_MS_BUDDY_MSG, file->super.from, 
					_("File transport timeout"), 
					PURPLE_MESSAGE_SYSTEM, 
					time(NULL));
	}
}