コード例 #1
0
netcoupler::netcoupler(QString s, QObject *parent) :
        QObject(parent), nick(s) {

    connect(volume, SIGNAL(valueChanged (int)),&singleton<sound_handler>(), SLOT(volumechange(int)));

    irc = new ircnet(nick, this);
    connect(irc, SIGNAL(sigusergarbage(const QString&,const QString&)),this, SIGNAL(sigusergarbage(const QString&,const QString&)));
    connect(irc, SIGNAL(sigusergarbagejoin(const QString&,const QString&)),this, SIGNAL(sigusergarbagejoin(const QString&,const QString&)));
    connect(irc, SIGNAL(sigusergarbagepart(const QString&,const QString&)),this, SIGNAL(sigusergarbagepart(const QString&,const QString&)));
    connect(irc, SIGNAL(sigusergarbagequit(const QString&,const QString&)),this, SIGNAL(sigusergarbagequit(const QString&,const QString&)));
    connect(irc,SIGNAL(sigconnected()),this,SLOT(ircconnected()));
    connect(irc,SIGNAL(sigdisconnected()),this,SLOT(ircdiconnected()));
    http = new snoppanet(this);
    connect(http, SIGNAL(sigchannelscheme(QString,QString)),this, SLOT(getscheme(QString,QString)));
    connect(irc, SIGNAL(siggetlist(QStringList)),this, SLOT(getchannellist(QStringList)));
    connect(irc, SIGNAL(sigmsg(const QString&,const QString&,const QString&)),this, SLOT(getmsg(const QString&,const QString&,const QString&)));
    connect(irc, SIGNAL(signotice(const QString&,const QString&,const QString&)),this, SLOT(getnotice(const QString&,const QString&,const QString&)));
    connect(irc, SIGNAL(siggotidletime(const QString&, int)),this, SIGNAL(siggotidletime(const QString&, int)));
    connect(irc, SIGNAL(signosuchnick(const QString&)),this, SIGNAL(signosuchnick(const QString&)));
    connect(http, SIGNAL(sighostlist(QList<hoststruct>,QString)),this, SLOT(gethostlist(QList<hoststruct>,QString)));
    connect(&users, SIGNAL(sigbuddyarrived()),&singleton<balloon_handler>(), SLOT(buddyarrived()));
    connect(&users, SIGNAL(sigbuddyleft()),&singleton<balloon_handler>(), SLOT(buddyleft()));
    connect(this,SIGNAL(sigconnected()),&singleton<balloon_handler>(),SLOT(connected()));
    connect(this,SIGNAL(sigdisconnected()),&singleton<balloon_handler>(),SLOT(disconnected()));
    QStringList sl = inihandler.stringlistfromini("[irc ip]");
    if (sl.isEmpty()) {
        connect(http, SIGNAL(sigircip(QString)),this, SLOT(getircip(QString)));
        http->start();
    } else {
        ircip = sl.first();
        irc->setip(ircip);
        irc->start();
        usesettingswindow("sbwhorepead");
    }
    connect(QApplication::instance(), SIGNAL(aboutToQuit()),this, SLOT(sendquit()));
    p->setProcessChannelMode(QProcess::MergedChannels);
    connect(p, SIGNAL(finished (int , QProcess::ExitStatus)),this, SLOT(processfinished(int , QProcess::ExitStatus)));
    connect(p, SIGNAL(readyRead()),this, SLOT(readprocess()));
    isaway = 0;
    usesettingswindow("cbsetawaywhilegaming");
    usesettingswindow("leawaystring");

    mutedusers = singleton<snpsettings>().map["mutedusers"].toStringList();
    connect(this, SIGNAL(sigsettingswindowchanged()),this, SLOT(usesettingswindow()));
    connect(this, SIGNAL(sigsettingswindowchanged()),&users, SLOT(usesettingswindow()));
}
コード例 #2
0
ファイル: url.cpp プロジェクト: wodconf/libabb
static bool parse(const std::string& url,URL* outurl,bool viaRequest){
	if(url == "" && viaRequest){
		LOG(WARN) << "empty url";
		return false;
	}

	if(url == "*"){
		outurl->Path = "*";
		return true;
	}
	//http://test.com/path?q=1
	std::string rest;
	if(!getscheme(url,outurl->Scheme,rest)){
		return false;
	}
	//  //test.com/path?q=1
	std::string left;//  
	split(rest, "?", true, left , outurl->RawQuery);
	// //test.com/path
	if(left.find("/") != 0){
		if(outurl->Scheme != ""){
			outurl->Opaque = left;
			return true;
		}else if(viaRequest){
			LOG(WARN) << "invalid URI for request";
			return false;
		}
	}

	if(outurl->Scheme != "" || !viaRequest && left.find("///") != 0 && left.find("//") == 0){
	// test.com/path
		split(left.substr(2), "/", false,outurl->Host,left);
		//  /path
		if( outurl->Host.find("%") != std::string::npos){
			LOG(WARN) << "hexadecimal escape in host";
			return false;
		}
	}
	return unescape(left,encodePath,outurl->Path);
}
コード例 #3
0
        connect(&users, SIGNAL(sigbuddyleft()),&singleton<balloon_handler>(), SLOT(buddyleft()));
        connect(this,SIGNAL(sigconnected()),&singleton<balloon_handler>(),SLOT(connected()));
        connect(this,SIGNAL(sigdisconnected()),&singleton<balloon_handler>(),SLOT(disconnected()));
        connect(p, SIGNAL(readyRead()),this, SLOT(readprocess()));

        connect(this, SIGNAL(sigsettingswindowchanged()),this, SLOT(initSoundAndStartWho()));
        connect(this, SIGNAL(sigsettingswindowchanged()),&users, SLOT(usesettingswindow()));
    }
    connectstate=e_started;
    nick=s;
    S_S.append("mutedusers", nick);
    irc = new ircnet(s, this);    
    connect(irc,SIGNAL(sigconnected()),this,SLOT(ircconnected()));
    connect(irc,SIGNAL(sigdisconnected()),this,SLOT(ircdisconnected()));
    http = new snoppanet(this);
    connect(http, SIGNAL(sigchannelscheme(QString,QString)),this, SLOT(getscheme(QString,QString)));
    connect(irc, SIGNAL(siggetlist(QStringList)),this, SLOT(getchannellist(QStringList)));    
    connect(irc, SIGNAL(siggotusermessage(const usermessage)),this,SLOT(getusermessage(const usermessage)));
    connect(irc, SIGNAL(siggotidletime(const QString&, int)),this, SIGNAL(siggotidletime(const QString&, int)));
    connect(irc, SIGNAL(signosuchnick(const QString&)),this, SIGNAL(signosuchnick(const QString&)));
    connect(http, SIGNAL(sighostlist(QList<hoststruct>,QString)),this, SLOT(gethostlist(QList<hoststruct>,QString)));
    connect(http,SIGNAL(sigloginfailed()),this,SIGNAL(sigdisconnected()));
    connect(http,SIGNAL(sigstarthost(QString)),this,SLOT(getmywormnethost(QString)));
//    connect(http,SIGNAL(sighoststarts(QString)),this,SLOT(getmywormnethost(hoststruct)));
    QStringList sl = inihandler.stringlistfromini("[irc ip]");
    if (sl.isEmpty()) {
        connect(http, SIGNAL(sigircip(QString)),this, SLOT(getircip(QString)));
        http->start();
    } else {
        ircip = sl.first();
        irc->setip(ircip);
コード例 #4
0
ファイル: mc_uri.c プロジェクト: hewenhao2008/mcoap
/**
 * Parse host, port, path, and query components from uri.
 * If destination host and/or port are in the URI they are elided
 * from the options list.
 *
 * @todo Does not reject URI's with fragments (RFC7252 6.4 Step 4).
 * @todo Does perform percent-decoding.
 *
 * Note: Host is elided if it matches desthost, RFC7252 says this only
 * happens if desthost is IP v6 or v4 literal. We rely on the caller
 * to only pass in the desthost string if it is an IP literal.
 *
 * @return the corresponding options list or 0 on error.
 */
mc_options_list_t* mc_uri_to_options(mc_options_list_t* const list, sockaddr_t* const dest, char* const uri) {
	mc_option_t* options;
	sockaddr_t uriaddr;
	char* host;
	char* path;
	char* query;
	uint32_t port;
	uint32_t nopts;
	uint32_t iopt;

	char* current = (char*)uri;
	char* scheme = getscheme(current);
	if (!validscheme(scheme)) {
		if (scheme) ms_free(scheme);
		return 0;
	}
	ms_free(scheme);

	current = advanceto(current, ":");
	current = advanceby(current, "://");
	if (!current) {
		return 0;
	}

	host = getaddress(current);
	if (!host) {
		return 0;
	}

	if (strlen(host) == 0) {
		ms_free(host);
		return 0;
	}

	/* Check and compensate for IP v6 []'s if needed. */
	if (current && (*current == '[')) current += 2;

	current += strlen(host);
	port = getport(current);
	current = advanceto(current, "/?");

	/* Estimate the number of options needed based on remaining path, */
	/* and if the destination matches the URI, then allocate the option array. */
	/* Note the RFC only omits the host if it is an IP literal. */
	nopts = estimatenopts(current);
	mn_sockaddr_inet_init(&uriaddr, host, port);
	if (!equaladdr(&uriaddr, dest)) {
		nopts += 2;
	}
	options = ms_calloc(nopts, mc_option_t);

	/* Note does not properly account for IP literal requirement in section 6.4 step 5. */
	iopt = 0;
	if (!equaladdr(&uriaddr, dest)) {
		mc_option_init_str(&options[iopt], OPTION_URI_HOST, host);
		iopt++;

		mc_option_init_uint32(&options[iopt], OPTION_URI_PORT, port);
		iopt++;
	}

	path = getpath(current);
	while (path) {
		mc_option_init_str(&options[iopt], OPTION_URI_PATH, ms_copy_str(path));
		iopt++;
		current = advanceto(++current, "/?");
		ms_free(path);
		path = getpath(current);
	}

	query = getquery(current);
	while (query) {
		mc_option_init_str(&options[iopt], OPTION_URI_QUERY, ms_copy_str(query));
		iopt++;
		current = advanceto(++current, "&");
		ms_free(query);
		query= getquery(current);
	}

	return mc_options_list_init(mc_options_list_alloc(), iopt, options);
}