JabberPlugin::JabberPlugin() : p( 0 ), m_menu ( 0 ) { if( !accountName().isEmpty() ) m_menu = new QMenu(QString("Jabber (").append(accountName()).append(")")); else m_menu = new QMenu(QString("Jabber")); m_addFriendAction = m_menu->addAction("Add Friend..."); connect(m_addFriendAction, SIGNAL(triggered()), this, SLOT(showAddFriendDialog())); }
void AdapterSettings::validateAdapterSettings() { // validating for P2P use only in anticipation of INTEGRATION MODE being moved to a different adapter if (accountName().length() > 0 && providerName().length() > 0 && p2pModeApproverName().length() > 0 && p2pModeApproverEmail().length() > 0 && p2pClientUserId().length() > 0) { qDebug() << "EEEE adapter has values for all required settings"; setConfigured(true); } else { qDebug() << "EEEE adapter does not have values for all required settings"; setConfigured(false); } }
AccountConfigView::AccountConfigView(BRect rect, BMailAccountSettings* account) : BBox(rect), fAccount(account) { SetLabel(B_TRANSLATE("Account settings")); rect = Bounds().InsetByCopy(8, 8); rect.top += 10; CenterContainer *view = new CenterContainer(rect, false); view->SetSpacing(5); // determine font height font_height fontHeight; view->GetFontHeight(&fontHeight); int32 height = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 5; rect = view->Bounds(); rect.bottom = height + 5; BString accountName(B_TRANSLATE("Account name:")); BString realName(B_TRANSLATE("Real name:")); BString returnAddress(B_TRANSLATE("Return address:")); float labelWidth = view->StringWidth(accountName.String()) + (float)6; if (labelWidth < (view->StringWidth(realName.String()) + (float)6)) labelWidth = view->StringWidth(realName.String()) + (float)6; if (labelWidth < (view->StringWidth(returnAddress.String()) + (float)6)) labelWidth = view->StringWidth(returnAddress.String()) + (float)6; view->AddChild(fNameControl = new BTextControl(rect, NULL, accountName.String(), NULL, new BMessage(kMsgAccountNameChanged))); fNameControl->SetDivider(labelWidth); view->AddChild(fRealNameControl = new BTextControl(rect, NULL, realName.String(), NULL, NULL)); fRealNameControl->SetDivider(labelWidth); view->AddChild(fReturnAddressControl = new BTextControl(rect, NULL, returnAddress.String(), NULL, NULL)); fReturnAddressControl->SetDivider(labelWidth); // control->TextView()->HideTyping(true); float w, h; view->GetPreferredSize(&w, &h); ResizeTo(w + 15, h + 22); view->ResizeTo(w, h); AddChild(view); }
QVariantMap CoreAccount::toVariantMap(bool forcePassword) const { QVariantMap v; v["AccountId"] = accountId().toInt(); // can't use AccountId because then comparison fails v["AccountName"] = accountName(); v["Uuid"] = uuid().toString(); v["Internal"] = isInternal(); v["User"] = user(); if (_storePassword || forcePassword) v["Password"] = password(); else v["Password"] = QString(); v["StorePassword"] = storePassword(); v["HostName"] = hostName(); v["Port"] = port(); v["UseSSL"] = useSsl(); v["ProxyType"] = proxyType(); v["ProxyUser"] = proxyUser(); v["ProxyPassword"] = proxyPassword(); v["ProxyHostName"] = proxyHostName(); v["ProxyPort"] = proxyPort(); return v; }
static bool HandleWarnCommand(ChatHandler* handler, char const* args) { if (!*args) return false; ///- Get the command line arguments char* accountStr = strtok((char*)args, " "); char* reasonStr = strtok(NULL, " "); char* severityStr = strtok(NULL, " "); if (!accountStr || !reasonStr) return false; uint32 severity = severityStr ? atoi(severityStr) : 1; std::string accountName(accountStr); if (!AccountMgr::normalizeString(accountName)) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } uint32 accountId = AccountMgr::GetId(accountName); if (!accountId) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } QueryResult result = LoginDatabase.PQuery("SELECT MAX(Verwarnstufe) FROM `account_verwarnung` WHERE ACCGUID = %u AND datum >= now()-interval 6 month AND IsInfo = 0", accountId); int32 severitySum = 0; if (result) { Field* field = result->Fetch(); severitySum += field[0].GetUInt32(); } handler->PSendSysMessage("Aktuelle Verwarnstufe %u + Hinzuzufuegende Verwarnstufe %u = Neue Verwarnstufe %u", severitySum, severity, severitySum + severity); if (severitySum >= 5) { handler->PSendSysMessage("Die Verwarnung schlug fehl, weil der Account bereits die höchste Verwarnstufe erreicht hat."); handler->SetSentErrorMessage(true); return false; } severitySum += severity; char* banDuration = "0"; switch (severitySum) { case 2: banDuration = "1d"; break; case 3: banDuration = "7d"; break; case 4: banDuration = "28d"; break; case 5: banDuration = "-1"; break; } if (severitySum >= 2) sWorld->BanAccount(BAN_ACCOUNT, accountName, banDuration, reasonStr, handler->GetSession()->GetPlayer()->GetName()); LoginDatabase.DirectPExecute("INSERT INTO `account_verwarnung` (ACCGUID, Verwarnstufe, Kommentar, Creator, Datum, Executed) VALUES (%u, %u, '%s', %u, NOW(), 1)", accountId, severitySum, reasonStr, handler->GetSession()->GetAccountId()); if (severitySum >= 2) handler->PSendSysMessage("Der Account %s wurde verwarnt und hat nun die Verwarnstufe %u. Der Account wurde dafuer %s gesperrt.", accountName.c_str(), severitySum, severitySum >= 5 ? "permanent" : banDuration); else handler->PSendSysMessage("Der Account %s wurde verwarnt und hat nun die Verwarnstufe %u. Der Account wurde dafuer nicht gesperrt.", accountName.c_str(), severitySum); return true; }
void MessageSender::send() { //! [associate-account] QString accountName(accountCombo->currentText()); if (accountName.isEmpty()) { QMessageBox::warning(0, tr("Missing information"), tr("No account is selected for transmission")); return; } QMessage message; QPair<QMessage::Type, QMessageAccountId> details = accountDetails[accountName]; message.setType(details.first); message.setParentAccountId(details.second); //! [associate-account] //! [set-recipients] QString to(toEdit->text()); if (to.isEmpty()) { QMessageBox::warning(0, tr("Missing information"), tr("Please enter a recipient address")); return; } // Find the address type to use for this message QMessageAddress::Type addrType(message.type() == QMessage::Email ? QMessageAddress::Email : QMessageAddress::Phone); QMessageAddressList toList; foreach (const QString &item, to.split(QRegExp("\\s"), QString::SkipEmptyParts)) { toList.append(QMessageAddress(addrType, item)); } message.setTo(toList); //! [set-recipients] //! [set-properties] if (message.type() == QMessage::Email) { QString subject(subjectEdit->text()); if (subject.isEmpty()) { QMessageBox::warning(0, tr("Missing information"), tr("Please enter a subject")); return; } message.setSubject(subject); } QString text(textEdit->toPlainText()); if (text.isEmpty()) { QMessageBox::warning(0, tr("Missing information"), tr("Please enter a message")); return; } message.setBody(text); //! [set-properties] //! [add-attachments] if (message.type() != QMessage::Sms) { if (attachmentsList->count()) { QStringList paths; for (int i = 0; i < attachmentsList->count(); ++i) { paths.append(attachmentsList->item(i)->text()); } message.appendAttachments(paths); } } //! [add-attachments] //! [send-message] sendButton->setEnabled(false); if (service.send(message)) { sendId = message.id(); } else { sendButton->setEnabled(true); QMessageBox::warning(0, tr("Failed"), tr("Unable to send message")); } //! [send-message] }