示例#1
0
  //--------------------------------------------------------------------------------
  LogStream& LogStream::setMessageType(std::string mt, const bool permanent /*= false*/)
  {
    boost::algorithm::to_lower(mt);

    if     (mt == "debug") { return setMessageType(LT_DEBUG , permanent); }
    else if(mt == "info" ) { return setMessageType(LT_INFO  , permanent); }
    else if(mt == "error") { return setMessageType(LT_ERROR , permanent); }
    else                   { return setMessageType(LT_INFO  , permanent); } // yes, this default to info level is intentional
  }
示例#2
0
 static void ICQCALLBACK replyButton(hWindow btn, hWindow hwnd)
 {
	ICQMSGDIALOG *cfg = icqskin_getWindowDataBlock(hwnd);
	
	if(cfg->mgr && cfg->mgr->reply)
       setMessageType(hwnd,cfg,cfg->mgr->reply);	
	else
       setMessageType(hwnd,cfg,MSG_NORMAL);	
	
 }
示例#3
0
void MessageWidget::setMessage(const QString &msg, MessageType type, bool showCloseButton)
{
    if (isActive() && !msg.isEmpty() && type!=msgType) {
        setVisible(false);
    }
    msgType=type;
    if (msg.isEmpty() && isVisible()) {
        setVisible(false);
        return;
    }
//    QString text=msg;
//    if (text.length()>154) {
//        text=text.left(150)+QLatin1String("...");
//    }
//    if (msg.length()>500) {
//        setToolTip(msg.left(500)+QLatin1String("..."));
//    } else {
//        setToolTip(msg);
//    }
//    setText(text);
    setText(msg);
    setToolTip(msg);
    setMessageType(type);
    setCloseButtonVisible(showCloseButton);
    #if defined NO_ANIMATED_SHOW
    setVisible(true);
    #else
    if (!parentWidget()->isVisible()) {
        show();
        setVisible(true);
    } else {
        animatedShow();
    }
    #endif
}
示例#4
0
void Container::contactSelected(int)
{
    UserWnd *userWnd = m_tabBar->currentWnd();
    if (userWnd == NULL)
        return;
    m_wnds->raiseWidget(userWnd);
    userWnd->setFocus();
    m_bar->setParam((void*)userWnd->id());
    QString name = userWnd->getName();
    Command cmd;
    cmd->id = CmdContainerContact;
    cmd->text_wrk = NULL;
    if (!name.isEmpty())
        cmd->text_wrk = strdup(name.utf8());
    cmd->icon  = userWnd->getIcon();
    cmd->param = (void*)(userWnd->id());
    cmd->popup_id = MenuContainerContact;
    cmd->flags = BTN_PICT;
    Event e(EventCommandChange, cmd);
    m_bar->processEvent(&e);
    setMessageType(userWnd->type());
    setIcon(Pict(cmd->icon));
    setCaption(userWnd->getLongName());
    m_bar->checkState();
    m_status->message(userWnd->status());
    if (isActiveWindow())
        userWnd->markAsRead();
}
示例#5
0
void MessageWidget::setMessage(const QString &msg, bool isError)
{
    if (msg.isEmpty() && isVisible()) {
        setVisible(false);
        return;
    }
    QString text=msg;
    if (text.length()>154) {
        text=text.left(150)+QLatin1String("...");
    }
    if (msg.length()>500) {
        setToolTip(msg.left(500)+QLatin1String("..."));
    } else {
        setToolTip(msg);
    }
    setText(text);
    setMessageType(isError ? Error : Information);
    #if defined NO_ANIMATED_SHOW
    setVisible(true);
    #else
    if (!parentWidget()->isVisible()) {
        show();
        setVisible(true);
    } else {
        animatedShow();
    }
    #endif
}
示例#6
0
 static void ICQCALLBACK refuseButton(hWindow btn, hWindow hwnd)
 {
	ICQMSGDIALOG *cfg      = icqskin_getWindowDataBlock(hwnd);
    cfg->idleSeconds = 0;

    setMessageType(hwnd, cfg, MSG_REFUSED);

 }
ZrtpPacketCommit::ZrtpPacketCommit() {
    DEBUGOUT((fprintf(stdout, "Creating commit packet without data\n")));

    zrtpHeader = &data.hdr;	// the standard header
    commitHeader = &data.commit;

    setZrtpId();
    setLength((sizeof (CommitPacket_t) / ZRTP_WORD_SIZE) - 1);
    setMessageType((uint8_t*)CommitMsg);
}
示例#8
0
void MsgEdit::setState()
{
    if (sendEvent)
        emit setStatus(i18n("Sending"));
    emit setSendState(sendEvent == NULL);
    unsigned short msgType = 0;
    if (message()){
        msgType = message()->Type();
        emit setMessageType(Client::getMessageIcon(msgType), Client::getMessageText(msgType));
    }
    btnSend->setText(sendEvent ? i18n("&Cancel") : i18n("&Send"));
    chkClose->setEnabled(sendEvent == NULL);
    phone->setEnabled(sendEvent == NULL);
    url->setEnabled(sendEvent == NULL);
    edit->setEnabled(sendEvent == NULL);
    users->setEnabled(sendEvent == NULL);
    file->setEnabled(sendEvent == NULL);
}
示例#9
0
PasswordBar::PasswordBar(QWidget *parent)
            :KMessageWidget(parent)
{
    setCloseButtonVisible(false);
    setMessageType(KMessageWidget::Information);

    QAction* action = new QAction(i18nc("@action:remember password", "&Remember"), this);
    connect(action, SIGNAL(triggered()), this, SLOT(onRememberButtonClicked()));
    addAction(action);

    action = new QAction(i18nc("@action:never for this site", "Ne&ver for this site"), this);
    connect(action, SIGNAL(triggered()), this, SLOT(onNeverButtonClicked()));
    addAction(action);

    action = new QAction(i18nc("@action:not now", "N&ot now"), this);
    connect(action, SIGNAL(triggered()), this, SLOT(onNotNowButtonClicked()));
    addAction(action);
}
示例#10
0
UserWnd::UserWnd(unsigned id, Buffer *cfg, bool bReceived, bool bAdjust)
        : QSplitter(Qt::Horizontal, NULL)
{
    load_data(userWndData, &data, cfg);
    m_id = id;
    m_bResize = false;
    m_bClosed = false;
    m_bTyping = false;
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    m_hSplitter = new QSplitter(Qt::Horizontal, this);
    m_splitter = new QSplitter(Qt::Vertical, m_hSplitter);
    m_list = NULL;
    m_view = NULL;

    if (cfg == NULL)
        memcpy(data.editBar, CorePlugin::m_plugin->data.editBar, sizeof(data.editBar));

    m_bBarChanged = true;
    if (CorePlugin::m_plugin->getContainerMode())
        bReceived = false;
    m_edit = new MsgEdit(m_splitter, this);
    setFocusProxy(m_edit);
    restoreToolbar(m_edit->m_bar, data.editBar);
    m_edit->m_bar->show();
    m_bBarChanged = false;

    connect(m_edit, SIGNAL(toolBarPositionChanged(Q3ToolBar*)), this, SLOT(toolbarChanged(Q3ToolBar*)));
    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));
    connect(m_edit, SIGNAL(heightChanged(int)), this, SLOT(editHeightChanged(int)));
    modeChanged();

    if (!bAdjust && getMessageType() == 0)
        return;

    if (!m_edit->adjustType()){
        unsigned type = getMessageType();
        Message *msg = new Message(MessageGeneric);
        setMessage(&msg);
        delete msg;
        setMessageType(type);
    }
}
bool osmsMessageRegisterContentAssignIdentifierRequest::decode(char* xmlText)
{
	XMLDocument* pDoc = new XMLDocument();
	if (pDoc == NULL)
		return false;

	if (!pDoc->decode(xmlText, getName()))
	{
		delete pDoc;
		return false;
	}

	setMessageType(pDoc->getInteger("MessageType"));
	setMetadataType(pDoc->getString("MetadataType"));
	setMetadataXml(pDoc->getString("MetadataXml"));

	delete pDoc;

	return true;
}
bool osmsMessageRegisterDigitalItemInstanceResponseError::decode(char* xmlText)
{
	XMLDocument* pDoc = new XMLDocument();
	if (pDoc == NULL)
		return false;

	if (!pDoc->decode(xmlText, getName()))
	{
		delete pDoc;
		return false;
	}

	setMessageType(pDoc->getInteger("MessageType"));
	setErrorCode(pDoc->getInteger("ErrorCode"));
	setResponseString(pDoc->getString("ResponseString"));

	delete pDoc;

	return true;
}
KexiServerDriverNotFoundMessage::KexiServerDriverNotFoundMessage(QWidget *parent):
    KexiContextMessageWidget(parent, 0, 0,
            KexiContextMessage (
                xi18nc("@info",
                "<title>No database server drivers found</title>"
                "<para>Connection to a database server requires an appropriate driver which "
                "you do not have installed.</para>"
                "<subtitle>Details</subtitle>"
                "<para>To obtain database drivers please use your Package Manager to search "
                "and install packages with so-called <emphasis>KDb drivers</emphasis> named <filename>kdb-****-driver</filename>. "
                "Please note that your package names could vary slightly depending on the "
                "operating system you use.</para>"))
            )
{
        setMessageType(KMessageWidget::Warning);
        setCalloutPointerDirection(KMessageWidget::NoPointer);
        setWordWrap(true);
        setClickClosesMessage(false);
        setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
}
bool osmsMessageCreateUserRequest::decode(char* xmlText)
{
	XMLDocument* pDoc = new XMLDocument();
	if (pDoc == NULL)
		return false;

	if (!pDoc->decode(xmlText, getName()))
	{
		delete pDoc;
		return false;
	}

	setMessageType(pDoc->getInteger("MessageType"));
	setUserName(pDoc->getString("UserName"));
	setPassword(pDoc->getString("Password"));
	setEmailAddress(pDoc->getString("EmailAddress"));

	delete pDoc;

	return true;
}
bool osmsMessageRightsAuthorizationResponse::decode(char* xmlText)
{
	XMLDocument* pDoc = new XMLDocument();
	if (pDoc == NULL)
		return false;

	if (!pDoc->decode(xmlText, getName()))
	{
		delete pDoc;
		return false;
	}

	setMessageType(pDoc->getInteger("MessageType"));
  char* tmp = pDoc->getString("TransactionId");
	setTransactionId(tmp);
  delete[] tmp;

	delete pDoc;

	return true;
}
bool osmsMessageUserLoginResponseError::decode(char* xmlText)
{
	XMLDocument* pDoc = new XMLDocument();
	if (pDoc == NULL)
		return false;

	if (!pDoc->decode(xmlText, getName()))
	{
		delete pDoc;
		return false;
	}

	setMessageType(pDoc->getInteger("MessageType"));
	setErrorCode(pDoc->getInteger("ErrorCode"));
  char* tmp = pDoc->getString("ResponseString");
	setResponseString(tmp);
  delete[] tmp;

	delete pDoc;

	return true;
}
示例#17
0
CrashMessageBar::CrashMessageBar(const QString &message, QWidget *parent)
    : KMessageWidget(parent)
{
    connect(this, SIGNAL(accepted()), this, SLOT(hideAndDelete()));
    connect(this, SIGNAL(rejected()), this, SLOT(hideAndDelete()));

    setMessageType(KMessageWidget::Warning);

    QSize sz = size();
    sz.setWidth(qobject_cast<QWidget *>(parent)->size().width());
    resize(sz);

    setCloseButtonVisible(false);

    setText(message);

    QAction *acceptAction = new QAction(i18n("Yes"), this);
    connect(acceptAction, SIGNAL(triggered(bool)), this, SIGNAL(accepted()));
    addAction(acceptAction);

    QAction *rejectAction = new QAction(i18n("No"), this);
    connect(rejectAction, SIGNAL(triggered(bool)), this, SIGNAL(rejected()));
    addAction(rejectAction);
}
示例#18
0
void SSHMessageKeyDHReplay::impl_initPacket(void) {
  SSHMessage::impl_initPacket();
  setMessageType(SSHMessage::SSH_MSG_KEX_31);
}
示例#19
0
void SSHMessageKeyDHInit::impl_initPacket(void) {
    SSHMessage::impl_initPacket();
    setMessageType(SSHMessage::SSH_MSG_KEX_30);
}
示例#20
0
void ZrtpPacketHello::configureHello(ZrtpConfigure* config) {
    // The NumSupported* data is in ZrtpTextData.h 
    nHash = config->getNumConfiguredAlgos(HashAlgorithm);
    nCipher = config->getNumConfiguredAlgos(CipherAlgorithm);
    nPubkey = config->getNumConfiguredAlgos(PubKeyAlgorithm);
    nSas = config->getNumConfiguredAlgos(SasType);
    nAuth = config->getNumConfiguredAlgos(AuthLength);

    // length is fixed Header plus HMAC size (2*ZRTP_WORD_SIZE)
    int32_t length = sizeof(HelloPacket_t) + (2 * ZRTP_WORD_SIZE);
    length += nHash * ZRTP_WORD_SIZE;
    length += nCipher * ZRTP_WORD_SIZE;
    length += nPubkey * ZRTP_WORD_SIZE;
    length += nSas * ZRTP_WORD_SIZE;
    length += nAuth * ZRTP_WORD_SIZE;

    // Don't change order of this sequence
    oHash = sizeof(Hello_t);
    oCipher = oHash + (nHash * ZRTP_WORD_SIZE);
    oAuth = oCipher + (nCipher * ZRTP_WORD_SIZE);
    oPubkey = oAuth + (nAuth * ZRTP_WORD_SIZE);
    oSas = oPubkey + (nPubkey * ZRTP_WORD_SIZE);
    oHmac = oSas + (nSas * ZRTP_WORD_SIZE);         // offset to HMAC

    void* allocated = &data;
    memset(allocated, 0, sizeof(data));

    zrtpHeader = (zrtpPacketHeader_t *)&((HelloPacket_t *)allocated)->hdr;	// the standard header
    helloHeader = (Hello_t *)&((HelloPacket_t *)allocated)->hello;

    setZrtpId();

    // minus 1 for CRC size 
    setLength(length / ZRTP_WORD_SIZE);
    setMessageType((uint8_t*)HelloMsg);

    setVersion((uint8_t*)zrtpVersion);

    uint32_t lenField = nHash << 16;
    for (int32_t i = 0; i < nHash; i++) {
        AlgorithmEnum& hash = config->getAlgoAt(HashAlgorithm, i);
        setHashType(i, (int8_t*)hash.getName());
    }

    lenField |= nCipher << 12;
    for (int32_t i = 0; i < nCipher; i++) {
        AlgorithmEnum& cipher = config->getAlgoAt(CipherAlgorithm, i);
        setCipherType(i, (int8_t*)cipher.getName());
    }

    lenField |= nAuth << 8;
    for (int32_t i = 0; i < nAuth; i++) {
        AlgorithmEnum& length = config->getAlgoAt(AuthLength, i);
        setAuthLen(i, (int8_t*)length.getName());
    }

    lenField |= nPubkey << 4;
    for (int32_t i = 0; i < nPubkey; i++) {
        AlgorithmEnum& pubKey = config->getAlgoAt(PubKeyAlgorithm, i);
        setPubKeyType(i, (int8_t*)pubKey.getName());
    }

    lenField |= nSas;
    for (int32_t i = 0; i < nSas; i++) {
        AlgorithmEnum& sas = config->getAlgoAt(SasType, i);
        setSasType(i, (int8_t*)sas.getName());
    }
    *((uint32_t*)&helloHeader->flags) = zrtpHtonl(lenField);
}