亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nntp.cpp

?? Linux下的基于X11的圖形開發(fā)環(huán)境。
?? CPP
字號:
/****************************************************************************** $Id: qt/nntp.cpp   3.1.1   edited Nov 8 10:35 $**** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.**** This file is part of an example program for Qt.  This example** program may be used, distributed and modified without limitation.*******************************************************************************/#include "nntp.h"#include <qurlinfo.h>#include <stdlib.h>#include <qurloperator.h>#include <qstringlist.h>#include <qregexp.h>Nntp::Nntp()    : QNetworkProtocol(), connectionReady( FALSE ),      readGroups( FALSE ), readArticle( FALSE ){    // create the command socket and connect to its signals    commandSocket = new QSocket( this );    connect( commandSocket, SIGNAL( hostFound() ),	     this, SLOT( hostFound() ) );    connect( commandSocket, SIGNAL( connected() ),	     this, SLOT( connected() ) );    connect( commandSocket, SIGNAL( connectionClosed() ),	     this, SLOT( closed() ) );    connect( commandSocket, SIGNAL( readyRead() ),	     this, SLOT( readyRead() ) );    connect( commandSocket, SIGNAL( error( int ) ),	     this, SLOT( error( int ) ) );}Nntp::~Nntp(){    close();    delete commandSocket;}void Nntp::operationListChildren( QNetworkOperation * ){    // create a command    QString path = url()->path(), cmd;    if ( path.isEmpty() || path == "/" ) {	// if the path is empty or we are in the root dir,	// we want to read the list of available newsgroups	cmd = "list newsgroups\r\n";    } else if ( url()->isDir() ) {	// if the path is a directory (in our case a news group)	// we want to list the articles of this group	path = path.replace( "/", "" );	cmd = "listgroup " + path + "\r\n";    } else	return;    // write the command to the socket    commandSocket->writeBlock( cmd.latin1(), cmd.length() );    readGroups = TRUE;}void Nntp::operationGet( QNetworkOperation *op ){    // get the dirPath of the URL (this is our news group)    // and the filename (which is the article we want to read)    QUrl u( op->arg( 0 ) );    QString dirPath = u.dirPath(), file = u.fileName();    dirPath = dirPath.replace( "/", "" );    // go to the group in which the article is    QString cmd;    cmd = "group " + dirPath + "\r\n";    commandSocket->writeBlock( cmd.latin1(), cmd.length() );    // read the head of the article    cmd = "article " + file + "\r\n";    commandSocket->writeBlock( cmd.latin1(), cmd.length() );    readArticle = TRUE;}bool Nntp::checkConnection( QNetworkOperation * ){    // we are connected, return TRUE    if ( commandSocket->isOpen() && connectionReady )	return TRUE;    // seems that there is no chance to connect    if ( commandSocket->isOpen() )	return FALSE;    // don't call connectToHost() if we are already trying to connect    if ( commandSocket->state() == QSocket::Connecting )	return FALSE;    // start connecting    connectionReady = FALSE;    commandSocket->connectToHost( url()->host(),				  url()->port() != -1 ? url()->port() : 119 );    return FALSE;}void Nntp::close(){    // close the command socket    if ( commandSocket->isOpen() ) { 	commandSocket->writeBlock( "quit\r\n", strlen( "quit\r\n" ) ); 	commandSocket->close();    }}int Nntp::supportedOperations() const{    // we only support listing children and getting data    return OpListChildren | OpGet;}void Nntp::hostFound(){    if ( url() )	emit connectionStateChanged( ConHostFound, tr( "Host %1 found" ).arg( url()->host() ) );    else	emit connectionStateChanged( ConHostFound, tr( "Host found" ) );}void Nntp::connected(){    if ( url() )	emit connectionStateChanged( ConConnected, tr( "Connected to host %1" ).arg( url()->host() ) );    else	emit connectionStateChanged( ConConnected, tr( "Connected to host" ) );}void Nntp::closed(){    if ( url() )	emit connectionStateChanged( ConClosed, tr( "Connection to %1 closed" ).arg( url()->host() ) );    else	emit connectionStateChanged( ConClosed, tr( "Connection closed" ) );}void Nntp::readyRead(){    // new data arrived on the command socket    // of we should read the list of available groups, let's do so    if ( readGroups ) {	parseGroups();	return;    }    // of we should read an article, let's do so    if ( readArticle ) {	parseArticle();	return;    }    // read the new data from the socket    QCString s;    s.resize( commandSocket->bytesAvailable() );    commandSocket->readBlock( s.data(), commandSocket->bytesAvailable() );    if ( !url() )	return;    // of the code of the server response was 200, we know that the    // server is ready to get commands from us now    if ( s.left( 3 ) == "200" )	connectionReady = TRUE;}void Nntp::parseGroups(){    if ( !commandSocket->canReadLine() )	return;    // read one line after the other    while ( commandSocket->canReadLine() ) {	QString s = commandSocket->readLine();	// if the  line starts with a dot, all groups or articles have been listed,	// so we finished processing the listChildren() command	if ( s[ 0 ] == '.' ) {	    readGroups = FALSE;	    operationInProgress()->setState( StDone );	    emit finished( operationInProgress() );	    return;	}	// if the code of the server response is 215 or 211	// the next line will be the first group or article (depending on what we read).	// So let others know that we start reading now...	if ( s.left( 3 ) == "215" || s.left( 3 ) == "211" ) {	    operationInProgress()->setState( StInProgress );	    emit start( operationInProgress() );	    continue;	}	// parse the line and create a QUrlInfo object	// which describes the child (group or article)	bool tab = s.find( '\t' ) != -1;	QString group = s.mid( 0, s.find( tab ? '\t' : ' ' ) );	QUrlInfo inf;	inf.setName( group );	QString path = url()->path();	inf.setDir( path.isEmpty() || path == "/" );	inf.setSymLink( FALSE );	inf.setFile( !inf.isDir() );	inf.setWritable( FALSE );	inf.setReadable( TRUE );	// let others know about our new child	emit newChild( inf, operationInProgress() );    }}void Nntp::parseArticle(){    if ( !commandSocket->canReadLine() )	return;    // read an article one line after the other    while ( commandSocket->canReadLine() ) {	QString s = commandSocket->readLine();	// if the  line starts with a dot, we finished reading something	if ( s[ 0 ] == '.' ) {	    readArticle = FALSE;	    operationInProgress()->setState( StDone );	    emit finished( operationInProgress() );	    return;	}	if ( s.right( 1 ) == "\n" )	    s.remove( s.length() - 1, 1 );	// emit the new data of the article which we read	emit data( QCString( s.ascii() ), operationInProgress() );    }}void Nntp::error( int code ){    if ( code == QSocket::ErrHostNotFound ||	 code == QSocket::ErrConnectionRefused ) {	// this signal is called if connecting to the server failed	if ( operationInProgress() ) {	    QString msg = tr( "Host not found or couldn't connect to: \n" + url()->host() );	    operationInProgress()->setState( StFailed );	    operationInProgress()->setProtocolDetail( msg );	    operationInProgress()->setErrorCode( (int)ErrHostNotFound );	    clearOperationQueue();	    emit finished( operationInProgress() );	}    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99精品欧美一区二区蜜桃免费| 精品播放一区二区| 久久综合av免费| 亚洲日本乱码在线观看| 韩国三级中文字幕hd久久精品| 欧美三级三级三级| 国产精品剧情在线亚洲| 久久精品国产成人一区二区三区 | 国产精品传媒入口麻豆| 久久er精品视频| 91精品国产色综合久久| 亚洲精品五月天| 不卡av在线网| 国产日韩精品一区| 国产在线不卡视频| 欧美大片一区二区| 欧美aⅴ一区二区三区视频| 欧美在线短视频| 亚洲乱码日产精品bd| 99精品在线免费| 国产欧美一区二区精品秋霞影院| 日本91福利区| 欧美久久久一区| 亚洲一区二区三区美女| 色欧美片视频在线观看 | 成人av午夜电影| 国产日韩亚洲欧美综合| 久久99国产精品久久| 欧美一区二区视频免费观看| 亚洲一区二区三区在线播放| 欧美午夜一区二区三区免费大片| 亚洲精品少妇30p| 一本大道久久a久久综合| 中文字幕欧美区| 91小视频在线| 亚洲另类在线制服丝袜| 一本色道久久综合精品竹菊| 亚洲欧美韩国综合色| 欧美性大战久久久久久久| 一区二区激情小说| 欧美日韩二区三区| 蜜臀av一级做a爰片久久| 日韩精品中文字幕一区二区三区| 蜜桃一区二区三区在线| 精品剧情在线观看| 国产成人在线视频网址| 国产精品久久久久永久免费观看 | 欧美一区二区三区四区在线观看| 午夜精品123| 日韩一二三区不卡| 国产一区二区精品久久99| 国产女人18水真多18精品一级做| 成人av电影在线| 一区二区三区在线免费播放| 在线综合+亚洲+欧美中文字幕| 蜜臀av亚洲一区中文字幕| 中文av一区二区| 欧美天堂一区二区三区| 美女视频黄频大全不卡视频在线播放 | 欧美电视剧在线观看完整版| 国产成人av电影在线| 亚洲日本在线a| 欧美一区二区三区日韩视频| 国产在线观看一区二区| 国产精品毛片a∨一区二区三区| 91久久精品一区二区三区| 日韩电影在线一区二区| 国产精品视频线看| 91精品国产一区二区三区| 成人av在线一区二区| 蜜乳av一区二区三区| 亚洲色图丝袜美腿| 日韩精品自拍偷拍| 色综合网色综合| 国产一区二区调教| 亚洲国产人成综合网站| 国产欧美日韩在线观看| 在线播放/欧美激情| 99v久久综合狠狠综合久久| 日韩精品每日更新| 亚洲欧美在线另类| 久久久91精品国产一区二区三区| 在线欧美一区二区| 成人性生交大片免费看中文网站| 污片在线观看一区二区| 国产精品美女久久久久aⅴ | 喷水一区二区三区| 亚洲人成精品久久久久久| 精品国产91九色蝌蚪| 欧美日韩国产在线播放网站| 不卡免费追剧大全电视剧网站| 日韩精品电影一区亚洲| 日韩毛片精品高清免费| 久久综合九色综合久久久精品综合| 色伊人久久综合中文字幕| 国产精品一区二区三区网站| 午夜久久久久久| 国产精品久久久久精k8| 国产情人综合久久777777| 日韩午夜在线观看| 欧美一二区视频| 欧美日韩亚洲不卡| 欧洲国产伦久久久久久久| 99久久综合精品| 成人性生交大片免费看中文| 国产真实精品久久二三区| 免费看欧美美女黄的网站| 国产成人亚洲综合a∨婷婷 | 精品国产乱码久久久久久牛牛| 欧洲精品在线观看| 在线视频亚洲一区| 色综合久久久久久久久久久| av不卡免费在线观看| 99视频一区二区三区| 91理论电影在线观看| 色综合天天综合在线视频| 91一区二区在线| 色呦呦网站一区| 91在线你懂得| 色综合久久六月婷婷中文字幕| 一本色道a无线码一区v| 在线观看免费视频综合| 精品视频1区2区| 欧美一区二区三区四区在线观看| 欧美一区二区精品在线| 欧美videos中文字幕| 精品国产1区二区| 欧美激情自拍偷拍| 亚洲精品伦理在线| 亚洲二区在线视频| 日本中文在线一区| 国产乱码精品一区二区三区av| 国产不卡在线播放| 色香蕉久久蜜桃| 在线播放/欧美激情| 久久精品人人做| 亚洲精品免费看| 男人的j进女人的j一区| 福利电影一区二区三区| 欧美视频自拍偷拍| 国产亚洲欧美日韩在线一区| 亚洲人成电影网站色mp4| 人人爽香蕉精品| 成人福利视频网站| 欧美日韩在线一区二区| 26uuu国产日韩综合| 亚洲欧美一区二区视频| 蜜臀av一区二区| 91日韩精品一区| 日韩午夜av电影| 最新高清无码专区| 日韩va亚洲va欧美va久久| 国产成人免费在线视频| 欧美在线免费播放| 精品国产一区二区三区忘忧草| 亚洲欧洲av在线| 美女精品自拍一二三四| 99久久国产综合精品女不卡| 91精品国产综合久久精品图片| 中文字幕国产一区| 日本va欧美va精品| 91香蕉视频污在线| 久久综合九色综合97婷婷女人 | 成人免费看的视频| 欧美精品日韩综合在线| 亚洲国产精品激情在线观看| 亚洲一区二区精品久久av| 国产在线一区二区| 欧美日韩国产一级片| 国产精品久久久久久一区二区三区| 亚洲va天堂va国产va久| av一本久道久久综合久久鬼色| 日韩一区二区三区观看| 亚洲精品中文字幕在线观看| 国产伦精一区二区三区| 欧美一级视频精品观看| 亚洲一二三四在线观看| 国产91高潮流白浆在线麻豆| 日韩一区二区免费在线观看| 亚洲激情综合网| 91在线云播放| 中文字幕在线观看不卡| 国内外精品视频| 日韩美女一区二区三区四区| 亚洲综合久久久| 色婷婷综合中文久久一本| 国产欧美日韩在线| 国产不卡在线视频| 国产午夜精品一区二区三区嫩草| 天堂成人免费av电影一区| 一本大道久久a久久精二百 | 欧美激情在线免费观看| 国产一区激情在线| 精品成人免费观看| 韩国精品主播一区二区在线观看 | 高清视频一区二区| 久久久不卡影院| 国产麻豆欧美日韩一区| 久久久不卡网国产精品二区| 麻豆精品在线观看|