本文整理汇总了C++中KviCString类的典型用法代码示例。如果您正苦于以下问题:C++ KviCString类的具体用法?C++ KviCString怎么用?C++ KviCString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KviCString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printSSLCertificate
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());
}
示例2: it
void KviModuleExtensionManager::unregisterExtensionsByModule(KviModule * m)
{
KviPointerHashTableIterator<const char *,KviModuleExtensionDescriptorList> it(*m_pExtensionDict);
KviPointerList<KviCString> dying;
dying.setAutoDelete(true);
while(KviModuleExtensionDescriptorList * l = it.current())
{
KviPointerList<KviModuleExtensionDescriptor> dying2;
dying2.setAutoDelete(true);
for(KviModuleExtensionDescriptor * d = l->first();d;d = l->next())
{
if(d->module() == m)dying2.append(d);
}
for(KviModuleExtensionDescriptor * de = dying2.first();de;de = dying2.next())
{
l->removeRef(de);
}
if(l->isEmpty())dying.append(new KviCString(it.currentKey()));
++it;
}
for(KviCString * li = dying.first();li;li = dying.next())
{
m_pExtensionDict->remove(li->ptr());
}
}
示例3:
bool KviIpcSentinel::x11GetRemoteMessage()
{
Atom type;
int format;
unsigned long nItems, after;
unsigned char * data = nullptr;
KviCString szData;
if(XGetWindowProperty(kvi_ipc_get_xdisplay(), winId(), kvi_atom_ipc_remote_command,
0, 1024, false, XA_STRING, &type, &format, &nItems, &after, &data) == Success)
{
if((type == XA_STRING) && (format == 8) && (nItems > 8) && data)
{
kvi_u32_t uSenderId = *((kvi_u32_t *)(data));
if(uSenderId != g_uLocalInstanceId)
szData = (char *)(data + 8);
XFree((char *)data);
}
}
if(szData.isEmpty())
return false; // no command, or our own command
kvi_ipcSetRemoteCommand(winId(), "");
if(g_pApp)
g_pApp->ipcMessage(szData.ptr());
return true;
}
示例4: encrypt
KviCryptEngine::EncryptResult KviMircryptionEngine::encrypt(const char * plainText, KviCString & outBuffer)
{
KviCString szPlain = plainText;
outBuffer = "";
if(m_bEncryptCBC)
{
if(!doEncryptCBC(szPlain, outBuffer))
return KviCryptEngine::EncryptError;
}
else
{
if(!doEncryptECB(szPlain, outBuffer))
return KviCryptEngine::EncryptError;
}
outBuffer.prepend("+OK ");
if(outBuffer.len() > maxEncryptLen())
{
if(maxEncryptLen() > 0)
{
setLastError(__tr2qs("Data buffer too long"));
return KviCryptEngine::EncryptError;
}
}
//outBuffer = MCPS2_STARTTAG;
//outBuffer += MCPS2_ENDTAG;
return KviCryptEngine::Encrypted;
}
示例5: output
void DccVoiceWindow::connectionInProgress()
{
if(m_pDescriptor->bActive)
{
output(KVI_OUT_DCCMSG,__tr2qs_ctx("Contacting host %Q on port %Q","dcc"),&(m_pDescriptor->szIp),&(m_pDescriptor->szPort));
} else {
output(KVI_OUT_DCCMSG,__tr2qs_ctx("Listening on interface %Q port %Q","dcc"),
&(m_pMarshal->localIp()),&(m_pMarshal->localPort()));
if(m_pDescriptor->bSendRequest)
{
QString ip = !m_pDescriptor->szFakeIp.isEmpty() ? m_pDescriptor->szFakeIp : m_pDescriptor->szListenIp;
KviCString port = !m_pDescriptor->szFakePort.isEmpty() ? m_pDescriptor->szFakePort : m_pMarshal->localPort();
//#warning "OPTION FOR SENDING 127.0.0.1 and so on (not an unsigned nuumber)"
struct in_addr a;
if(KviNetUtils::stringIpToBinaryIp(ip,&a)) {
ip.setNum(htonl(a.s_addr));
}
m_pDescriptor->console()->connection()->sendFmtData("PRIVMSG %s :%cDCC VOICE %s %Q %s %d%c",
m_pDescriptor->console()->connection()->encodeText(m_pDescriptor->szNick).data(),
0x01,m_pDescriptor->szCodec.ptr(),
&ip,port.ptr(),m_pDescriptor->iSampleRate,0x01);
output(KVI_OUT_DCCMSG,__tr2qs_ctx("Sent DCC VOICE (%s) request to %Q, waiting for the remote client to connect...","dcc"),
m_pDescriptor->szCodec.ptr(),&(m_pDescriptor->szNick));
} else output(KVI_OUT_DCCMSG,__tr2qs_ctx("DCC VOICE request not sent: awaiting manual connections","dcc"));
}
}
示例6: clear
void KviProxyDataBase::load(const QString &filename)
{
clear();
KviConfigurationFile cfg(filename,KviConfigurationFile::Read);
unsigned int nEntries = cfg.readUIntEntry("Entries",0);
for(unsigned int i=0;i<nEntries;i++)
{
KviProxy * p = new KviProxy();
KviCString tmp(KviCString::Format,"%u_Hostname",i);
p->m_szHostname = cfg.readEntry(tmp.ptr(),"proxy.example.net");
tmp.sprintf("%u_Port",i);
p->m_uPort = cfg.readUIntEntry(tmp.ptr(),7000);
tmp.sprintf("%u_Ip",i);
p->m_szIp = cfg.readEntry(tmp.ptr(),"");
tmp.sprintf("%u_User",i);
p->m_szUser = cfg.readEntry(tmp.ptr(),"");
tmp.sprintf("%u_Pass",i);
p->m_szPass = cfg.readEntry(tmp.ptr(),"");
tmp.sprintf("%u_Protocol",i);
KviCString type = cfg.readEntry(tmp.ptr(),"SOCKSv4");
p->setNamedProtocol(type.ptr());
tmp.sprintf("%u_IsIPv6",i);
p->m_bIsIPv6 = cfg.readBoolEntry(tmp.ptr(),false);
tmp.sprintf("%u_Current",i);
if(cfg.readBoolEntry(tmp.ptr(),false))m_pCurrentProxy = p;
m_pProxyList->append(p);
}
if(!m_pCurrentProxy)m_pCurrentProxy = m_pProxyList->first();
}
示例7: decode
void decode(KviCString & szText, unsigned char ** buf, int *len)
{
// make sure its length is multiple of 12 (eventually pad with zeroes)
if(szText.len() % 12)
{
int oldL = szText.len();
szText.setLen(szText.len() + (12 - (szText.len() % 12)));
char * padB = szText.ptr() + oldL;
char * padE = szText.ptr() + szText.len();
while(padB < padE)*padB++ = 0;
}
*len = (int)(szText.len() * 2) / 3;
*buf = (unsigned char *)KviMemory::allocate(*len);
unsigned char * p = (unsigned char *)szText.ptr();
unsigned char * e = p + szText.len();
int i;
unsigned char * bufp = *buf;
while(p < e)
{
quint32 * dw1 = (quint32 *)bufp;
bufp += 4;
quint32 * dw2 = (quint32 *)bufp;
bufp += 4;
*dw2 = 0;
for(i=0;i < 6;i++)*dw2 |= (fake_base64dec(*p++)) << (i * 6);
*dw1 = 0;
for(i=0;i < 6;i++)*dw1 |= (fake_base64dec(*p++)) << (i * 6);
}
// FIXME: this is probably needed only on LittleEndian machines!
byteswap_buffer(*buf,*len);
}
示例8: encrypt
KviCryptEngine::EncryptResult KviLamerizerEngine::encrypt(const char * plainText,KviCString &outBuffer)
{
outBuffer = plainText;
unsigned char * aux = (unsigned char *)outBuffer.ptr();
if(m_bLight)
{
while(*aux)
{
if(subst_table_light[*aux])
{
*aux = subst_table_light[*aux];
}
aux++;
}
} else {
while(*aux)
{
if(subst_table[*aux])
{
*aux = subst_table[*aux];
}
aux++;
}
}
if(!m_bLight)
{
outBuffer.replaceAll("F","Ph");
outBuffer.replaceAll("V","\\/");
}
return KviCryptEngine::Encoded;
}
示例9: switch
bool DccVoiceWindow::event(QEvent *e)
{
if(e->type() == KVI_THREAD_EVENT)
{
switch(((KviThreadEvent *)e)->id())
{
case KVI_DCC_THREAD_EVENT_ERROR:
{
KviError::Code * pError = ((KviThreadDataEvent<KviError::Code> *)e)->getData();
QString ssss = KviError::getDescription(*pError);
output(KVI_OUT_DCCERROR,__tr2qs_ctx("ERROR: %Q","dcc"),&(ssss));
delete pError;
m_pUpdateTimer->stop();
updateInfo();
m_pTalkButton->setEnabled(false);
m_pRecordingLabel->setEnabled(false);
m_pPlayingLabel->setEnabled(false);
return true;
}
break;
case KVI_DCC_THREAD_EVENT_MESSAGE:
{
KviCString * str = ((KviThreadDataEvent<KviCString> *)e)->getData();
outputNoFmt(KVI_OUT_DCCMSG,__tr_no_xgettext_ctx(str->ptr(),"dcc"));
delete str;
return true;
}
break;
case KVI_DCC_THREAD_EVENT_ACTION:
{
int * act = ((KviThreadDataEvent<int> *)e)->getData();
switch(*act)
{
case KVI_DCC_VOICE_THREAD_ACTION_START_RECORDING:
m_pRecordingLabel->setEnabled(true);
break;
case KVI_DCC_VOICE_THREAD_ACTION_STOP_RECORDING:
m_pRecordingLabel->setEnabled(false);
break;
case KVI_DCC_VOICE_THREAD_ACTION_START_PLAYING:
m_pPlayingLabel->setEnabled(true);
break;
case KVI_DCC_VOICE_THREAD_ACTION_STOP_PLAYING:
m_pPlayingLabel->setEnabled(false);
break;
}
delete act;
return true;
}
break;
default:
qDebug("Invalid event type %d received",((KviThreadEvent *)e)->id());
break;
}
}
return KviWindow::event(e);
}
示例10: editAllPropertiesClicked
void RegisteredUserEntryDialog::editAllPropertiesClicked()
{
m_pAvatarSelector->commit();
if(m_pAvatar->isNull())
{
m_pPropertyDict->remove("avatar");
} else {
KviCString szPath = m_pAvatar->path();
if(szPath.isEmpty())m_pPropertyDict->remove("avatar");
else m_pPropertyDict->replace("avatar",new QString(szPath));
}
if(m_pNotifyCheck->isChecked())
{
QString szNicks = m_pNotifyNick->text();
if(!szNicks.isEmpty())
{
m_pPropertyDict->replace("notify",new QString(szNicks));
} else {
m_pPropertyDict->remove("notify");
}
} else {
m_pPropertyDict->remove("notify");
}
RegisteredUserPropertiesDialog * dlg = new RegisteredUserPropertiesDialog(this,m_pPropertyDict);
if(dlg->exec() != QDialog::Accepted)
{
delete dlg;
return;
}
delete dlg;
QString * notify = m_pPropertyDict->find("notify");
bool bGotIt = false;
if(notify)
{
if(!notify->isEmpty())
{
bGotIt = true;
m_pNotifyNick->setText(*notify);
}
}
m_pNotifyCheck->setChecked(bGotIt);
m_pNotifyNick->setEnabled(bGotIt);
if(!bGotIt)m_pNotifyNick->setText("");
QString * avatar = m_pPropertyDict->find("avatar");
bGotIt = false;
if(avatar)
{
if(!avatar->isEmpty())
m_pAvatarSelector->setImagePath(*avatar);
}
}
示例11: load
bool KviFile::load(KviCString & szData)
{
kvi_u32_t iLen;
if(!load(iLen))
return false;
szData.setLen(iLen);
return (read((char *)(szData.ptr()), iLen) == iLen);
}
示例12: blockFromBuffer
void blockFromBuffer(KviCString & szBuffer)
{
indent(szBuffer);
szBuffer.prepend("{\n");
szBuffer.stripRightWhiteSpace();
szBuffer.ensureLastCharIs('\n');
szBuffer.append("}\n");
}
示例13: handleIsOn
bool KviStupidNotifyListManager::handleIsOn(KviIrcMessage * msg)
{
if(m_pConnection->lagMeter())
m_pConnection->lagMeter()->lagCheckComplete("@notify_naive");
KviCString nk;
const char * aux = msg->trailing();
while(*aux)
{
nk = "";
aux = kvi_extractToken(nk, aux, ' ');
if(nk.hasData())
{
QString nkd = m_pConnection->decodeText(nk.ptr());
QString nksp = " " + nkd;
m_szLastIsOnMsg.replace(nksp, "", Qt::CaseInsensitive);
if(!(m_pConsole->notifyListView()->findEntry(nkd)))
{
// not yet notified
notifyOnLine(nkd);
}
}
}
// ok...check the users that have left irc now...
QStringList sl = m_szLastIsOnMsg.isEmpty() ? QStringList() : m_szLastIsOnMsg.split(' ', QString::SkipEmptyParts);
for(auto & it : sl)
{
if(m_pConsole->notifyListView()->findEntry(it))
{
// has just left irc
notifyOffLine(it);
} // else has never been here...
}
if(((unsigned int)m_iNextNickToCheck) >= m_pNickList->count())
{
// have to restart
unsigned int iTimeout = KVI_OPTION_UINT(KviOption_uintNotifyListCheckTimeInSecs);
if(iTimeout < 5)
{
// life first of all.
// don't allow the user to suicide
if(_OUTPUT_VERBOSE)
m_pConsole->output(KVI_OUT_SYSTEMWARNING,
__tr2qs("Notify list: Timeout (%d sec) is too short, resetting to something more reasonable (5 sec)"),
iTimeout);
iTimeout = 5;
KVI_OPTION_UINT(KviOption_uintNotifyListCheckTimeInSecs) = 5;
}
m_iRestartTimer = startTimer(iTimeout * 1000);
}
else
sendIsOn();
return true;
}
示例14: indent
void indent(KviCString & szBuffer)
{
// we can format correctly up to 65536 lines (that's really enough)
int iRealLen;
KviCString ** pszArray = szBuffer.splitToArray('\n',65536,&iRealLen);
if(pszArray)
{
addLeading(pszArray,'\t');
szBuffer.joinFromArray(pszArray,"\n",true);
KviCString::freeArray(pszArray);
}
}
示例15: dcc_module_normalize_target_data
static bool dcc_module_normalize_target_data(KviDccRequest * dcc, KviCString & ipaddr, KviCString & port)
{
if(!port.isUnsignedNum())
{
if(!dcc->ctcpMsg->msg->haltOutput())
{
QString szError = QString(__tr2qs_ctx("Invalid port number %1", "dcc")).arg(port.ptr());
dcc_module_request_error(dcc, szError);
}
return false;
}
struct in_addr addr;
if(ipaddr.isUnsignedNum())
{
addr.s_addr = htonl((unsigned long)ipaddr.toULong());
QString tmp;
if(!KviNetUtils::binaryIpToStringIp(addr, tmp))
{
if(!dcc->ctcpMsg->msg->haltOutput())
{
QString szError = QString(__tr2qs_ctx("Invalid IP address in old format %1", "dcc")).arg(ipaddr.ptr());
dcc_module_request_error(dcc, szError);
}
return false;
}
ipaddr = tmp;
}
else
{
//FIXME: KviCString -> QString
if(!KviNetUtils::stringIpToBinaryIp(QString(ipaddr), &addr))
{
#ifdef COMPILE_IPV6_SUPPORT
struct in6_addr addr6;
if(KviNetUtils::stringIpToBinaryIp_V6(QString(ipaddr), &addr6))
{
dcc->bIPv6 = true;
return true; // IPV6 address.
}
#endif
if(!dcc->ctcpMsg->msg->haltOutput())
{
QString szError = QString(__tr2qs_ctx("Invalid IP address %1", "dcc")).arg(ipaddr.ptr());
dcc_module_request_error(dcc, szError);
}
return false;
}
}
return true;
}