Ejemplo n.º 1
0
void KviConfigurationFile::writeEntry(const QString & szKey,const QList<int> &list)
{
	m_bDirty = true;
	KviConfigurationFileGroup * p_group = getCurrentGroup();
	KviCString szData;
	for(QList<int>::ConstIterator it = list.begin();it != list.end();++it)
	{
		if(szData.hasData())szData.append(',');
		szData.append(KviCString::Format,"%d",*it);
	}
	//qDebug("Writing option list for group %s and key %s: %s",m_szGroup.latin1(),szKey.latin1(),szData.ptr());

	p_group->replace(szKey,new QString(szData.ptr()));
}
Ejemplo n.º 2
0
	KVIRC_API void printSSLCertificate(KviWindow * wnd, const char * description, KviSSLCertificate * c)
	{
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]: %c%s"), KviControlCodes::Bold, description);
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:  Version: %c%d"), KviControlCodes::Bold, c->version());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:  Serial number: %c%d"), KviControlCodes::Bold, c->serialNumber());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:  Subject:"));
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Common name: %c%s"), KviControlCodes::Bold, c->subjectCommonName());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Organization: %c%s"), KviControlCodes::Bold, c->subjectOrganization());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Organizational unit: %c%s"), KviControlCodes::Bold, c->subjectOrganizationalUnit());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Country: %c%s"), KviControlCodes::Bold, c->subjectCountry());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     State or province: %c%s"), KviControlCodes::Bold, c->subjectStateOrProvince());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Locality: %c%s"), KviControlCodes::Bold, c->subjectLocality());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:   Issuer:"));
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Common name: %c%s"), KviControlCodes::Bold, c->issuerCommonName());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Organization: %c%s"), KviControlCodes::Bold, c->issuerOrganization());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Organizational unit: %c%s"), KviControlCodes::Bold, c->issuerOrganizationalUnit());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Country: %c%s"), KviControlCodes::Bold, c->issuerCountry());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     State or province: %c%s"), KviControlCodes::Bold, c->issuerStateOrProvince());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:     Locality: %c%s"), KviControlCodes::Bold, c->issuerLocality());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:   Public key: %c%s (%d bits)"), KviControlCodes::Bold, c->publicKeyType(), c->publicKeyBits());
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:   Signature type: %c%s"), KviControlCodes::Bold, c->signatureType());
		KviCString tmp = c->signatureContents();
		if(tmp.len() > 40)
		{
			tmp.cutRight(tmp.len() - 40);
			tmp.append("...");
		}
		wnd->output(KVI_OUT_SSL, __tr2qs("[SSL]:   Signature contents: %c%s"), KviControlCodes::Bold, tmp.ptr());
	}
Ejemplo n.º 3
0
bool KviIrcUrl::parse(const char * url, KviCString & cmdBuffer, int contextSpec)
{
	// irc[6]://<server>[:<port>][/<channel>[?<pass>]]

	KviIrcUrlParts urlParts;
	KviIrcUrl::split(url, urlParts);

	if(urlParts.iError & InvalidUrl)
		return false;

	cmdBuffer = "server ";
	switch(contextSpec)
	{
		case KVI_IRCURL_CONTEXT_FIRSTFREE:
			cmdBuffer.append("-u ");
			break;
		case KVI_IRCURL_CONTEXT_NEW:
			cmdBuffer.append("-n ");
			break;
	}
	if(urlParts.bIPv6)
		cmdBuffer.append(" -i ");
	if(urlParts.bSsl)
		cmdBuffer.append(" -s ");

	QString channels, passwords;
	QStringList splitted;

	if(urlParts.chanList.size())
	{
		for(int i = 0; i < urlParts.chanList.size(); ++i)
		{
			splitted = urlParts.chanList[i].split("?");
			if(i)
				channels.append(",");
			if(!(splitted[0].startsWith("#") || splitted[0].startsWith("!") || splitted[0].startsWith("&")))
				channels.append("#");
			channels.append(splitted[0]);

			if(splitted.size() > 1)
			{
				if(i)
					passwords.append(",");
				passwords.append(splitted[1]);
			}
		}

		cmdBuffer.append(KviCString::Format, " -c=\"join %s %s\" ", channels.data(), passwords.data());
	}

	cmdBuffer.append(urlParts.szHost);
	cmdBuffer.append(KviCString::Format, " %d", urlParts.iPort);

	cmdBuffer.append(';');

	return true;
}
Ejemplo n.º 4
0
	void blockFromBuffer(KviCString & szBuffer)
	{
		indent(szBuffer);
		szBuffer.prepend("{\n");
		szBuffer.stripRightWhiteSpace();
		szBuffer.ensureLastCharIs('\n');
		szBuffer.append("}\n");
	}