/** * GetUnseenSeahubNotificationsRequest */ GetUnseenSeahubNotificationsRequest::GetUnseenSeahubNotificationsRequest(const Account& account) : SeafileApiRequest (account.getAbsoluteUrl(kUnseenMessagesUrl), SeafileApiRequest::METHOD_GET, account.token) { }
// Test the "signer_lists" argument in account_info. void testSignerLists() { using namespace jtx; Env env(*this, with_features(featureMultiSign)); Account const alice {"alice"}; env.fund(XRP(1000), alice); auto const withoutSigners = std::string ("{ ") + "\"account\": \"" + alice.human() + "\"}"; auto const withSigners = std::string ("{ ") + "\"account\": \"" + alice.human() + "\", " + "\"signer_lists\": true }"; // Alice has no SignerList yet. { // account_info without the "signer_lists" argument. auto const info = env.rpc ("json", "account_info", withoutSigners); BEAST_EXPECT(info.isMember(jss::result) && info[jss::result].isMember(jss::account_data)); BEAST_EXPECT(! info[jss::result][jss::account_data]. isMember (jss::signer_lists)); } { // account_info with the "signer_lists" argument. auto const info = env.rpc ("json", "account_info", withSigners); BEAST_EXPECT(info.isMember(jss::result) && info[jss::result].isMember(jss::account_data)); auto const& data = info[jss::result][jss::account_data]; BEAST_EXPECT(data.isMember (jss::signer_lists)); auto const& signerLists = data[jss::signer_lists]; BEAST_EXPECT(signerLists.isArray()); BEAST_EXPECT(signerLists.size() == 0); } // Give alice a SignerList. Account const bogie {"bogie"}; Json::Value const smallSigners = signers(alice, 2, { { bogie, 3 } }); env(smallSigners); { // account_info without the "signer_lists" argument. auto const info = env.rpc ("json", "account_info", withoutSigners); BEAST_EXPECT(info.isMember(jss::result) && info[jss::result].isMember(jss::account_data)); BEAST_EXPECT(! info[jss::result][jss::account_data]. isMember (jss::signer_lists)); } { // account_info with the "signer_lists" argument. auto const info = env.rpc ("json", "account_info", withSigners); BEAST_EXPECT(info.isMember(jss::result) && info[jss::result].isMember(jss::account_data)); auto const& data = info[jss::result][jss::account_data]; BEAST_EXPECT(data.isMember (jss::signer_lists)); auto const& signerLists = data[jss::signer_lists]; BEAST_EXPECT(signerLists.isArray()); BEAST_EXPECT(signerLists.size() == 1); auto const& signers = signerLists[0u]; BEAST_EXPECT(signers.isObject()); BEAST_EXPECT(signers[sfSignerQuorum.jsonName] == 2); auto const& signerEntries = signers[sfSignerEntries.jsonName]; BEAST_EXPECT(signerEntries.size() == 1); auto const& entry0 = signerEntries[0u][sfSignerEntry.jsonName]; BEAST_EXPECT(entry0[sfSignerWeight.jsonName] == 3); } // Give alice a big signer list Account const demon {"demon"}; Account const ghost {"ghost"}; Account const haunt {"haunt"}; Account const jinni {"jinni"}; Account const phase {"phase"}; Account const shade {"shade"}; Account const spook {"spook"}; Json::Value const bigSigners = signers(alice, 4, { {bogie, 1}, {demon, 1}, {ghost, 1}, {haunt, 1}, {jinni, 1}, {phase, 1}, {shade, 1}, {spook, 1}, }); env(bigSigners); { // account_info with the "signer_lists" argument. auto const info = env.rpc ("json", "account_info", withSigners); BEAST_EXPECT(info.isMember(jss::result) && info[jss::result].isMember(jss::account_data)); auto const& data = info[jss::result][jss::account_data]; BEAST_EXPECT(data.isMember (jss::signer_lists)); auto const& signerLists = data[jss::signer_lists]; BEAST_EXPECT(signerLists.isArray()); BEAST_EXPECT(signerLists.size() == 1); auto const& signers = signerLists[0u]; BEAST_EXPECT(signers.isObject()); BEAST_EXPECT(signers[sfSignerQuorum.jsonName] == 4); auto const& signerEntries = signers[sfSignerEntries.jsonName]; BEAST_EXPECT(signerEntries.size() == 8); for (unsigned i = 0u; i < 8; ++i) { auto const& entry = signerEntries[i][sfSignerEntry.jsonName]; BEAST_EXPECT(entry.size() == 2); BEAST_EXPECT(entry.isMember(sfAccount.jsonName)); BEAST_EXPECT(entry[sfSignerWeight.jsonName] == 1); } } }
//---------------------------------------------------------------------- int SipPhone::registerUser(const Account &acc) { QString user = acc.getUserName(); QString password = acc.getPassword(); QString domain = acc.getHost(); if (pjsua_acc_is_valid(acc_id_)) { LogInfo info(LogInfo::STATUS_WARNING, "pjsip", 0, "Account already exists"); signalLogData(info); return -1; } /* Register to SIP server by creating SIP account. */ pjsua_acc_config cfg; pjsua_acc_config_default(&cfg); QString id = "sip:"; id.append(user); id.append("@"); id.append(domain); QString reg_uri = "sip:"; reg_uri.append(domain); char ch_id[150]; char ch_reg_uri[100]; char ch_user[100]; char ch_password[100]; if (id.size() > 149 || reg_uri.size() > 99 || user.size() > 99 || password.size() > 99) { LogInfo info(LogInfo::STATUS_ERROR, "pjsip", 0, "Error adding account, data too long"); signalLogData(info); return -1; } strcpy(ch_id, id.toLocal8Bit().data()); ch_id[id.size()] = 0; strcpy(ch_reg_uri, reg_uri.toLocal8Bit().data()); ch_reg_uri[reg_uri.size()] = 0; strcpy(ch_user, user.toLocal8Bit().data()); ch_user[user.size()] = 0; strcpy(ch_password, password.toLocal8Bit().data()); ch_password[password.size()] = 0; cfg.id = pj_str(ch_id); cfg.reg_uri = pj_str(ch_reg_uri); cfg.cred_count = 1; cfg.cred_info[0].realm = pj_str((char*)"*"); cfg.cred_info[0].scheme = pj_str((char*)"digest"); cfg.cred_info[0].username = pj_str(ch_user); cfg.cred_info[0].data_type = 0; cfg.cred_info[0].data = pj_str(ch_password); pj_status_t status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id_); if (status != PJ_SUCCESS) { LogInfo info(LogInfo::STATUS_ERROR, "pjsip", status, "Error adding account"); signalLogData(info); return -1; } LogInfo info(LogInfo::STATUS_MESSAGE, "pjsip", 0, "Registered user with account-id " + QString::number(acc_id_)); signalLogData(info); return acc_id_; }
void Prefs::removeAccount(int accNumber) { Account* acc = accounts.at(accNumber); acc->remove(); accounts.removeAt(accNumber); }
virtual void makeBody(GDynamicPageSession* pSession, ostream& response) { if(pSession->paramsLen() <= 0) { // Show the upload form response << "You can submit a file here. It must be less than 25 MB.<br>\n"; response << "<form method='POST' enctype='multipart/form-data' action='/upload'>\n"; response << " Competition: <select name=competition>\n"; response << " <option value=\"1\">1) Classification predictive accuracy</option>\n"; response << " <option value=\"2\">2) Area under ROC curve with binary classification sets</option>\n"; response << " <option value=\"3\">3) Classification of hand-written numbers</option>\n"; response << " <option value=\"4\">4) Precision-recall with multi-class data</option>\n"; response << " <option value=\"5\">5) Efficient classification with large datasets</option>\n"; response << " <option value=\"6\">6) Precision-recall with multi-class data</option>\n"; response << " <option value=\"7\">7) Incremental/stream learning tests</option>\n"; response << " <option value=\"8\">8) Active learning tests</option>\n"; response << " <option value=\"9\">9) Robustness to irrelevant features tests</option>\n"; response << " </select><br>\n"; response << " File to upload: <input type=file name=upfile><br>\n"; response << " <input type=submit value=Submit> (Please press submit only once!)\n"; response << "</form><br><br>\n"; } else { // Make a folder for this upload Account* pAccount = getAccount(pSession); string s = m_basePath; s += "uploads/"; s += pAccount->username(); s += "/"; string timestamp; GTime::appendTimeStampValue(×tamp, true/*use GMT*/); s += timestamp; s += "/"; GFile::makeDir(s.c_str()); // Extract and save the uploaded data string meta = "username="******"\ntimestamp="; meta += timestamp; meta += "\n"; int nameStart, nameLen, valueStart, valueLen, filenameStart, filenameLen; GHttpMultipartParser parser(pSession->params(), pSession->paramsLen()); while(parser.next(&nameStart, &nameLen, &valueStart, &valueLen, &filenameStart, &filenameLen)) { if(nameStart >= 0) meta.append(pSession->params() + nameStart, nameLen); else meta += "?"; meta += "="; if(filenameStart >= 0) { meta.append(pSession->params() + filenameStart, filenameLen); string s2 = s; s2.append(pSession->params() + filenameStart, filenameLen); GFile::saveFile(pSession->params() + valueStart, valueLen, s2.c_str()); } else meta.append(pSession->params() + valueStart, valueLen); meta += "\n"; } s += "meta.txt"; GFile::saveFile(meta.c_str(), meta.length(), s.c_str()); // Send an email to notify the administrator // GSmtp::sendEmail("*****@*****.**", "*****@*****.**", "The following file has been uploaded", meta.c_str(), "smtp.domain.com"); // Inform the user that the submission was received response << "The following submission was received:<br><pre>\n"; response << meta.c_str(); response << "</pre><br><br>\n\n"; response << "Have a nice day!\n"; } }
MainConfigurationWindow::MainConfigurationWindow() : ConfigurationWindow("MainConfiguration", tr("Kadu configuration"), "General", instanceDataManager()), lookChatAdvanced(0) { setWindowRole("kadu-configuration"); widget()->appendUiFile(dataPath("kadu/configuration/dialog.ui")); #ifndef DEBUG_ENABLED ((QWidget *)(widget()->widgetById("debug")->parent()))->hide(); #endif #ifndef Q_OS_WIN ((QWidget *)(widget()->widgetById("startup")))->hide(); #endif #ifndef Q_WS_X11 ((QWidget *)(widget()->widgetById("windowActivationMethodGroup")))->hide(); ((QWidget *)(widget()->widgetById("notify/fullscreenSilentMode")))->hide(); #endif onStartupSetLastDescription = static_cast<QCheckBox *>(widget()->widgetById("onStartupSetLastDescription")); QLineEdit *disconnectDescription = static_cast<QLineEdit *>(widget()->widgetById("disconnectDescription")); QLineEdit *onStartupSetDescription = static_cast<QLineEdit *>(widget()->widgetById("onStartupSetDescription")); Account account = AccountManager::instance()->defaultAccount(); if (!account.isNull() && account.protocolHandler()) { disconnectDescription->setMaxLength(account.data()->maxDescriptionLength()); onStartupSetDescription->setMaxLength(account.data()->maxDescriptionLength()); } // connect(widget()->widgetById("advancedMode"), SIGNAL(toggled(bool)), widget()->widgetById("contactsWithIcons"), SLOT(setEnabled(bool))); connect(widget()->widgetById("showAvatars"), SIGNAL(toggled(bool)), widget()->widgetById("avatarBorder"), SLOT(setEnabled(bool))); connect(widget()->widgetById("showAvatars"), SIGNAL(toggled(bool)), widget()->widgetById("avatarGreyOut"), SLOT(setEnabled(bool))); connect(widget()->widgetById("disconnectWithCurrentDescription"), SIGNAL(toggled(bool)), disconnectDescription, SLOT(setDisabled(bool))); connect(onStartupSetLastDescription, SIGNAL(toggled(bool)), onStartupSetDescription, SLOT(setDisabled(bool))); connect(widget()->widgetById("foldLink"), SIGNAL(toggled(bool)), widget()->widgetById("linkFoldTreshold"), SLOT(setEnabled(bool))); connect(widget()->widgetById("chatPrune"), SIGNAL(toggled(bool)), widget()->widgetById("chatPruneLen"), SLOT(setEnabled(bool))); connect(widget()->widgetById("chatCloseTimer"), SIGNAL(toggled(bool)), widget()->widgetById("chatCloseTimerPeriod"), SLOT(setEnabled(bool))); connect(widget()->widgetById("startupStatus"), SIGNAL(activated(int)), this, SLOT(onChangeStartupStatus(int))); connect(widget()->widgetById("infoPanelBgFilled"), SIGNAL(toggled(bool)), widget()->widgetById("infoPanelBgColor"), SLOT(setEnabled(bool))); connect(widget()->widgetById("showDescription"), SIGNAL(toggled(bool)), widget()->widgetById("multilineDescription"), SLOT(setEnabled(bool))); // connect(widget()->widgetById("useDefaultServers"), SIGNAL(toggled(bool)), widget()->widgetById("serverList"), SLOT(setDisabled(bool))); connect(widget()->widgetById("openChatOnMessage"), SIGNAL(toggled(bool)), widget()->widgetById("openChatOnMessageWhenOnline"), SLOT(setEnabled(bool))); connect(widget()->widgetById("displayGroupTabs"), SIGNAL(toggled(bool)), widget()->widgetById("showGroupAll"), SLOT(setEnabled(bool))); emoticonsStyleComboBox = static_cast<ConfigComboBox *>(widget()->widgetById("emoticonsStyle")); emoticonsThemeComboBox = static_cast<ConfigComboBox *>(widget()->widgetById("emoticonsTheme")); emoticonsScalingComboBox = static_cast<ConfigComboBox *>(widget()->widgetById("emoticonsScaling")); connect(emoticonsThemeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onChangeEmoticonsTheme(int))); connect(widget()->widgetById("emoticonsPaths"), SIGNAL(changed()), this, SLOT(setEmoticonThemes())); QWidget *showInformationPanel = widget()->widgetById("showInformationPanel"); connect(showInformationPanel, SIGNAL(toggled(bool)), widget()->widgetById("showVerticalScrollbar"), SLOT(setEnabled(bool))); connect(showInformationPanel, SIGNAL(toggled(bool)), widget()->widgetById("showEmoticonsInPanel"), SLOT(setEnabled(bool))); ConfigCheckBox *useDefaultBrowserCheckbox = static_cast<ConfigCheckBox *>(widget()->widgetById("useDefaultBrowser")); ConfigLineEdit *browserCommandLineEdit = static_cast<ConfigLineEdit *>(widget()->widgetById("browserPath")); connect(useDefaultBrowserCheckbox, SIGNAL(toggled(bool)), browserCommandLineEdit, SLOT(setDisabled(bool))); ConfigCheckBox *useDefaultEMailCheckbox = static_cast<ConfigCheckBox *>(widget()->widgetById("useDefaultEMail")); ConfigLineEdit *mailCommandLineEdit = static_cast<ConfigLineEdit *>(widget()->widgetById("mailPath")); connect(useDefaultEMailCheckbox, SIGNAL(toggled(bool)), mailCommandLineEdit, SLOT(setDisabled(bool))); connect(widget()->widgetById("lookChatAdvanced"), SIGNAL(clicked()), this, SLOT(showLookChatAdvanced())); Preview *infoPanelSyntaxPreview = static_cast<Preview *>(widget()->widgetById("infoPanelSyntaxPreview")); infoPanelSyntaxPreview->setResetBackgroundColor(config_file.readEntry("Look", "InfoPanelBgColor")); connect(infoPanelSyntaxPreview, SIGNAL(needFixup(QString &)), Core::instance()->kaduWindow()->infoPanel(), SLOT(styleFixup(QString &))); connect(widget()->widgetById("infoPanelSyntax"), SIGNAL(syntaxChanged(const QString &)), infoPanelSyntaxPreview, SLOT(syntaxChanged(const QString &))); connect(widget()->widgetById("infoPanelSyntax"), SIGNAL(onSyntaxEditorWindowCreated(SyntaxEditorWindow *)), this, SLOT(onInfoPanelSyntaxEditorWindowCreated(SyntaxEditorWindow *))); connect(widget()->widgetById("iconPaths"), SIGNAL(changed()), this, SLOT(setIconThemes())); connect(widget()->widgetById("ignoreMessagesFromAnonymous"), SIGNAL(toggled(bool)), widget()->widgetById("ignoreMessagesFromAnonymousInConferences"), SLOT(setEnabled(bool))); QWidget *useUserboxBackground = widget()->widgetById("useUserboxBackground"); connect(useUserboxBackground, SIGNAL(toggled(bool)), widget()->widgetById("userboxBackground"), SLOT(setEnabled(bool))); connect(useUserboxBackground, SIGNAL(toggled(bool)), widget()->widgetById("userboxBackgroundDisplayStyle"), SLOT(setEnabled(bool))); widget()->widgetById("parseStatus")->setToolTip(qApp->translate("@default", SyntaxText)); (static_cast<ConfigSyntaxEditor *>(widget()->widgetById("infoPanelSyntax")))->setSyntaxHint(qApp->translate("@default", SyntaxText)); userboxTransparency = static_cast<QCheckBox *>(widget()->widgetById("userboxTransparency")); userboxAlpha = static_cast<QSlider *>(widget()->widgetById("userboxAlpha")); connect(userboxTransparency, SIGNAL(toggled(bool)), widget()->widgetById("userboxAlpha"), SLOT(setEnabled(bool))); buddyColors = new BuddyListBackgroundColorsWidget(this); triggerCompositingStateChanged(); }
void SystemAccounttest::test_getType() { const char * type = m_account->getType(); ASSERT_EQUAL(std::string("sys"), type); }
void AccountFactoryWrapperDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { QStyleOptionViewItemV4 opt = option; initStyleOption( &opt, index ); const int center = opt.rect.height() / 2 + opt.rect.top(); const int topIcon = center - ICON_SIZE/2; // draw the background const QWidget* w = opt.widget; QStyle* style = w ? w->style() : QApplication::style(); style->drawPrimitive( QStyle::PE_PanelItemViewItem, &opt, painter, w ); Account* acc = qobject_cast< Account* >( index.data( AccountFactoryWrapper::AccountRole ).value< QObject* >() ); Q_ASSERT( acc ); // Checkbox on left edge, then text const QRect checkRect( PADDING/4, PADDING/4 + opt.rect.top(), opt.rect.height() - PADDING/4, opt.rect.height() - PADDING/4 ); m_cachedCheckRects[ index ] = checkRect; QStyleOptionViewItemV4 opt2 = opt; opt2.rect = checkRect; opt.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off; style->drawPrimitive( QStyle::PE_IndicatorViewItemCheck, &opt2, painter, w ); // name on left painter->drawText( opt.rect.adjusted( checkRect.right() + PADDING, PADDING, -PADDING, -PADDING ), Qt::AlignLeft | Qt::AlignVCenter, acc->accountFriendlyName() ); // remove, config, status on right const QRect pmRect( opt.rect.right() - PADDING - ICON_SIZE, topIcon, ICON_SIZE, ICON_SIZE ); painter->drawPixmap( pmRect, TomahawkUtils::defaultPixmap( TomahawkUtils::ListRemove, TomahawkUtils::Original, pmRect.size() ) ); m_cachedButtonRects[ index ] = pmRect; const QRect confRect( pmRect.left() - PADDING - CONFIG_WRENCH_SIZE, center - CONFIG_WRENCH_SIZE/2, CONFIG_WRENCH_SIZE, CONFIG_WRENCH_SIZE ); QStyleOptionToolButton topt; topt.rect = confRect; topt.pos = confRect.topLeft(); topt.font = opt.font; topt.icon = ImageRegistry::instance()->pixmap( RESPATH "images/configure.svg", QSize( CONFIG_WRENCH_SIZE - 8, CONFIG_WRENCH_SIZE - 8 ) ); topt.iconSize = QSize( CONFIG_WRENCH_SIZE - 8, CONFIG_WRENCH_SIZE - 8 ); topt.subControls = QStyle::SC_ToolButton; topt.activeSubControls = QStyle::SC_None; topt.features = QStyleOptionToolButton::None; bool pressed = ( m_configPressed == opt.index ); topt.state = pressed ? QStyle::State_On : QStyle::State_Raised; if( opt.state & QStyle::State_MouseOver || pressed ) topt.state |= QStyle::State_HasFocus; style->drawComplexControl( QStyle::CC_ToolButton, &topt, painter, w ); m_cachedConfigRects[ index ] = confRect; QPixmap p; QString statusText; Account::ConnectionState state = acc->connectionState(); const QRect connectIconRect( confRect.left() - PADDING - ICON_SIZE, topIcon, ICON_SIZE, ICON_SIZE ); if ( state == Account::Connected ) { p = TomahawkUtils::defaultPixmap( TomahawkUtils::SipPluginOnline, TomahawkUtils::Original, connectIconRect.size() ); statusText = tr( "Online" ); } else if ( state == Account::Connecting ) { p = TomahawkUtils::defaultPixmap( TomahawkUtils::SipPluginOffline, TomahawkUtils::Original, connectIconRect.size() ); statusText = tr( "Connecting..." ); } else { p = TomahawkUtils::defaultPixmap( TomahawkUtils::SipPluginOffline, TomahawkUtils::Original, connectIconRect.size() ); statusText = tr( "Offline" ); } painter->drawPixmap( connectIconRect, p ); int width = painter->fontMetrics().width( statusText ); painter->drawText( QRect( connectIconRect.left() - PADDING - width, center - painter->fontMetrics().height()/2, width, painter->fontMetrics().height() ), statusText ); }
void HistoryWindow::on_dateTreeWidget_currentItemChanged(QTreeWidgetItem *dayItem, QTreeWidgetItem *) { QTreeWidgetItem *monthItem = dayItem ? dayItem->parent() : nullptr; if (!dayItem || !monthItem) return; if (dayItem->data(0, Qt::UserRole).type() != QVariant::Date) return; if (monthItem->data(0, Qt::UserRole).type() != QVariant::Date) return; auto contactIndex = ui.fromComboBox->currentIndex(); auto contactInfo = ui.fromComboBox->itemData(contactIndex).value<History::ContactInfo>(); auto date = dayItem->data(0, Qt::UserRole).toDate(); QDateTime from(date, QTime(0, 0)); QDateTime to(date, QTime(23, 59, 59, 999)); int count = std::numeric_limits<int>::max(); history()->read(contactInfo, from, to, count).connect(this, [this, contactInfo, date] (const MessageList &messages) { int contactIndex = ui.fromComboBox->currentIndex(); auto currentContactInfo = ui.fromComboBox->itemData(contactIndex).value<History::ContactInfo>(); if (!(currentContactInfo == contactInfo)) return; QTextDocument *doc = ui.historyLog->document(); doc->setParent(0); ui.historyLog->setDocument(0); doc->clear(); QTextCursor cursor = QTextCursor(doc); QTextCharFormat defaultFont = cursor.charFormat(); QTextCharFormat serviceFont = cursor.charFormat(); serviceFont.setForeground(Qt::darkGreen); serviceFont.setFontWeight(QFont::Bold); QTextCharFormat incomingFont = cursor.charFormat(); incomingFont.setForeground(Qt::red); incomingFont.setFontWeight(QFont::Bold); QTextCharFormat outgoingFont = cursor.charFormat(); outgoingFont.setForeground(Qt::blue); outgoingFont.setFontWeight(QFont::Bold); const QString serviceMessageTitle = tr("Service message"); const QString resultString = QStringLiteral("<span style='background: #ffff00'>\\1</span>"); cursor.beginEditBlock(); Account *account = findAccount(contactInfo); ChatUnit *unit = findContact(contactInfo); QString accountNickname = account ? account->name() : contactInfo.account; QString fromNickname = unit ? unit->title() : contactInfo.contact; int in_count = 0; int out_count = 0; for (const Message &message : messages) { bool service = message.property("service", false); QDateTime time = message.time(); bool incoming = message.isIncoming(); QString historyMessage = message.html(); QString sender = message.property("senderName", incoming ? fromNickname : accountNickname); incoming ? in_count++ : out_count++; if (service) { cursor.setCharFormat(serviceFont); cursor.insertText(serviceMessageTitle); } else { cursor.setCharFormat(incoming ? incomingFont : outgoingFont); cursor.insertText(sender); } cursor.insertText(QStringLiteral(" (") % time.toString(QStringLiteral("dd.MM.yyyy hh:mm:ss")) % QStringLiteral(")")); cursor.setCharFormat(defaultFont); cursor.insertText(QStringLiteral("\n")); if (m_search_word.isEmpty()) { cursor.insertHtml(historyMessage); cursor.insertText(QStringLiteral("\n")); } else { cursor.insertHtml(historyMessage.replace(m_search, resultString)); cursor.insertText(QStringLiteral("\n")); } } cursor.endEditBlock(); doc->setParent(ui.historyLog); ui.historyLog->setDocument(doc); if (m_search_word.isEmpty()) ui.historyLog->moveCursor(QTextCursor::End); else ui.historyLog->find(m_search_word); ui.historyLog->verticalScrollBar()->setValue(ui.historyLog->verticalScrollBar()->maximum()); ui.label_in->setText(tr("In: %L1").arg(in_count)); ui.label_out->setText(tr("Out: %L1").arg(out_count)); ui.label_all->setText(tr("All: %L1").arg(in_count + out_count)); }); }
SOM_Scope long SOMLINK Open(Bank *somSelf, Environment *ev, string name, long acct_type, long pin, long amount) { BankData *somThis = BankGetData(somSelf); BankMethodDebug("Bank","Open"); Account *temp; somf_TSetIterator *itr; trans_info *Tr; somf_TSet *set; somf_TPrimitiveLinkedList *llist; char *user_name; /* first check if the account already exists */ /* we create an iterator and walk through the account list */ itr = new somf_TSetIterator; switch (acct_type) { case Account_CHECKING: itr->somfTSetIteratorInit(ev, somSelf->_get_check_acct_set(ev)); break; case Account_SAVINGS: itr->somfTSetIteratorInit(ev, somSelf->_get_save_acct_set(ev)); break; case Account_MF: itr->somfTSetIteratorInit(ev, somSelf->_get_mf_acct_set(ev)); break; default: somPrintf (" bad account type\n"); return 9; } temp = (Account *)itr->somfFirst(ev); while (temp != SOMF_NIL ) { user_name = temp->_get_user_name(ev); if (strcmp(name, user_name) == 0) { /* acct already exists ? */ somPrintf("<%s> exists\n", name); return Account_ACCT_EXISTS; } else temp = (Account *)itr->somfNext(ev); } /* if we are here then we need to add the account * initialize all values (hardwire interest and min_balance) * allocate space for the new account */ user_name = (char *) malloc (strlen(name) + 1); strcpy (user_name, name); temp = new Account; temp->_set_user_name (ev, user_name); temp->_set_min_balance (ev, 0); temp->_set_act_balance (ev, amount); temp->_set_interest (ev, 5); temp->_set_pin (ev, pin); llist = new somf_TPrimitiveLinkedList; /* initialize the transaction list also */ Tr = new trans_info; Tr->_set_amount (ev, amount); Tr->_set_transaction (ev, Account_OPEN); Tr->_set_date (ev, time(0)); Tr->_set_curr_bal (ev, amount); llist->somfAddFirst(ev, Tr); /* now set up all the information to point correctly */ temp->_set_trans_list (ev, llist); /* now add the account to the appropriate set */ if (acct_type == Account_CHECKING) { set = somSelf->_get_check_acct_set(ev); set->somfAdd(ev, temp); } else if (acct_type == Account_SAVINGS) { set = somSelf->_get_save_acct_set(ev); set->somfAdd(ev, temp); } else if (acct_type == Account_MF) { set = somSelf->_get_mf_acct_set(ev); set->somfAdd(ev, temp); } itr->somFree(); return Account_OK; }
void AccountMgr::AddAccount(Field* field) { Account* acct = new Account; Sha1Hash hash; std::string Username = field[1].GetString(); std::string EncryptedPassword = field[2].GetString(); std::string GMFlags = field[3].GetString(); acct->AccountId = field[0].GetUInt32(); acct->AccountFlags = field[4].GetUInt8(); acct->Banned = field[5].GetUInt32(); if ((uint32)UNIXTIME > acct->Banned && acct->Banned != 0 && acct->Banned != 1) //1 = perm ban? { //Accounts should be unbanned once the date is past their set expiry date. acct->Banned = 0; //me go boom :( //printf("Account %s's ban has expired.\n",acct->UsernamePtr->c_str()); sLogonSQL->Execute("UPDATE accounts SET banned = 0 WHERE acct=%u", acct->AccountId); } acct->SetGMFlags(GMFlags.c_str()); acct->Locale[0] = 'e'; acct->Locale[1] = 'n'; acct->Locale[2] = 'U'; acct->Locale[3] = 'S'; if (strcmp(field[6].GetString(), "enUS")) { // non-standard language forced memcpy(acct->Locale, field[6].GetString(), 4); acct->forcedLocale = true; } else acct->forcedLocale = false; acct->Muted = field[7].GetUInt32(); if ((uint32)UNIXTIME > acct->Muted && acct->Muted != 0 && acct->Muted != 1) //1 = perm ban? { //Accounts should be unbanned once the date is past their set expiry date. acct->Muted = 0; //LOG_DEBUG("Account %s's mute has expired.",acct->UsernamePtr->c_str()); sLogonSQL->Execute("UPDATE accounts SET muted = 0 WHERE acct=%u", acct->AccountId); } // Convert username to uppercase. this is needed ;) arcemu_TOUPPER(Username); // prefer encrypted passwords over nonencrypted if (EncryptedPassword.size() > 0) { if (EncryptedPassword.size() == 40) { BigNumber bn; bn.SetHexStr(EncryptedPassword.c_str()); if (bn.GetNumBytes() < 20) { // Hacky fix memcpy(acct->SrpHash, bn.AsByteArray(), bn.GetNumBytes()); for (int n = bn.GetNumBytes(); n <= 19; n++) acct->SrpHash[n] = (uint8)0; reverse_array(acct->SrpHash, 20); } else { memcpy(acct->SrpHash, bn.AsByteArray(), 20); reverse_array(acct->SrpHash, 20); } } else { LOG_ERROR("Account `%s` has incorrect number of bytes in encrypted password! Disabling.", Username.c_str()); memset(acct->SrpHash, 0, 20); } } else { // This should never happen... LOG_ERROR("Account `%s` has no encrypted password!", Username.c_str()); } AccountDatabase[Username] = acct; }
QString &WebKitMessageViewStyle::fillKeywordsForBaseTemplate(QString &inString, qutim_sdk_0_3::ChatSession *session) { Q_D(WebKitMessageViewStyle); ChatUnit *unit = session->unit(); Account *account = unit->account(); Protocol *protocol = account->protocol(); // FIXME: Should be session->title inString.replace(QLatin1String("%chatName%"), escapeString(unit->title())); inString.replace(QLatin1String("%sourceName%"), escapeString(account->name())); inString.replace(QLatin1String("%destinationName%"), escapeString(unit->id())); inString.replace(QLatin1String("%destinationDisplayName%"), escapeString(unit->title())); QString iconPath; inString.replace(QLatin1String("%incomingColor%"), WebKitColorsAdditions::representedColorForObject(unit->id(), validSenderColors())); inString.replace(QLatin1String("%outgoingColor%"), WebKitColorsAdditions::representedColorForObject(account->name(), validSenderColors())); iconPath = urlFromFilePath(unit->property("avatar").toString()); if (iconPath.isEmpty()) { ChatUnit *contact = unit->upperUnit(); while (contact && iconPath.isEmpty()) { iconPath = contact->property("avatar").toString(); contact = contact->upperUnit(); } } inString.replace(QLatin1String("%incomingIconPath%"), iconPath.isEmpty() ? QString::fromLatin1("incoming_icon.png") : iconPath); iconPath = urlFromFilePath(account->property("avatar").toString()); inString.replace(QLatin1String("%outgoingIconPath%"), iconPath.isEmpty() ? QString::fromLatin1("outgoing_icon.png") : iconPath); // FIXME: Implement protocol.iconPath and protocol.shortDescription QString serviceIconPath = QString(); //account.protocol.iconPath; QString serviceIconTag = QString::fromLatin1("<img class=\"serviceIcon\" src=\"%1\" alt=\"%2\" title=\"%2\">") .arg(serviceIconPath.isEmpty() ? QString::fromLatin1("outgoing_icon.png") : serviceIconPath, protocol->id() /*shortDescription*/ ); inString.replace(QLatin1String("%serviceIconImg%"), serviceIconTag); inString.replace(QLatin1String("%serviceIconPath%"), serviceIconPath); inString.replace(QLatin1String("%timeOpened%"), convertTimeDate(d->timeStampFormatter, session->dateOpened())); //Replaces %time{x}% with a timestamp formatted like x (using NSDateFormatter) const QStringMatcher matcher(QLatin1String("%timeOpened{")); const int matcherSize = matcher.pattern().size(); const QStringMatcher endMatcher(QLatin1String("}%")); const int endMatcherSize = endMatcher.pattern().size(); int range = 0; do { range = matcher.indexIn(inString, range); if (range != -1) { int endRange = endMatcher.indexIn(inString, range + matcherSize); if (endRange != -1) { QString timeFormat = inString.mid(range + matcherSize, endRange - range - matcherSize); QString time = convertTimeDate(timeFormat, session->dateOpened()); inString.replace(range, endRange + endMatcherSize - range, time); range = range + time.size(); } } } while (range != -1); inString.replace(QLatin1String("%dateOpened%"), session->dateOpened().toString(Qt::SystemLocaleLongDate)); //Background { QLatin1String bodyBackground("==bodyBackground=="); range = inString.indexOf(bodyBackground); if (range != -1) { //a backgroundImage tag is not required QString bodyTag; if (d->allowsCustomBackground && (!d->customBackgroundPath.isEmpty() || d->customBackgroundColor.isValid())) { if (!d->customBackgroundPath.isNull()) { if (d->customBackgroundPath.length() > 0) { switch (d->customBackgroundType) { case BackgroundNormal: bodyTag.append(QString::fromLatin1("background-image: url('%1'); background-repeat: no-repeat; background-attachment:fixed;").arg(d->customBackgroundPath)); break; case BackgroundCenter: bodyTag.append(QString::fromLatin1("background-image: url('%1'); background-position: center; background-repeat: no-repeat; background-attachment:fixed;").arg(d->customBackgroundPath)); break; case BackgroundTile: bodyTag.append(QString::fromLatin1("background-image: url('%1'); background-repeat: repeat;").arg(d->customBackgroundPath)); break; case BackgroundTileCenter: bodyTag.append(QString::fromLatin1("background-image: url('%1'); background-repeat: repeat; background-position: center;").arg(d->customBackgroundPath)); break; case BackgroundScale: bodyTag.append(QString::fromLatin1("background-image: url('%1'); -webkit-background-size: 100%% 100%%; background-size: 100%% 100%%; background-attachment: fixed;").arg(d->customBackgroundPath)); break; } } else { bodyTag.append(QLatin1String("background-image: none; ")); } } if (d->customBackgroundColor.isValid()) { qreal red, green, blue, alpha; d->customBackgroundColor.getRgbF(&red, &green, &blue, &alpha); bodyTag.append(QString::fromLatin1("background-color: rgba(%1, %2, %3, %4); ") .arg(QString::number(int(red * 255.0)), QString::number(int(green * 255.0)), QString::number(int(blue * 255.0)), QString::number(alpha, 'f'))); } } //Replace the body background tag inString.replace(range, qstrlen(bodyBackground.latin1()), bodyTag); } } inString.replace(QLatin1String("%variant%"), activeVariantPath()); return inString; }
GetStarredFilesRequest::GetStarredFilesRequest(const Account& account) : SeafileApiRequest (account.getAbsoluteUrl(kStarredFilesUrl), SeafileApiRequest::METHOD_GET, account.token) { }
CreateDefaultRepoRequest::CreateDefaultRepoRequest(const Account& account) : SeafileApiRequest (account.getAbsoluteUrl(kDefaultRepoUrl), SeafileApiRequest::METHOD_POST, account.token) { }
friend bool operator == (Account const& fir, Account const& sec) { // (1) return fir.getBalance() == sec.getBalance(); }
double TransactionServices::getPreTransactionBalance(int accId) { Account* acc = _ds->getAccount(accId); return acc->getBalance(); }
/// /// [1] Account Scripting Object Methods /// /// All methods except GetProp and GetCharacter return 1 on success /// All methods except GetProp and GetCharacter write the accounts.txt file on success. /// All methods return Error("Not enough parameters") if too few parameters were passed. /// All methods return Error("Invalid parameter type") if the wrong type was passed. /// Bscript::BObjectImp* AccountObjImp::call_method_id( const int id, Bscript::Executor& ex, bool forcebuiltin ) { using namespace Bscript; BObjectImp* result = NULL; switch ( id ) { case MTH_GET_MEMBER: { if ( !ex.hasParams( 1 ) ) return new BError( "Not enough parameters" ); const String* mname; if ( ex.getStringParam( 0, mname ) ) { BObjectRef ref_temp = get_member( mname->value().c_str() ); BObjectRef& ref = ref_temp; BObject *bo = ref.get(); BObjectImp *ret = bo->impptr(); ret = ret->copy(); if ( ret->isa( OTUninit ) ) { string message = string( "Member " ) + string( mname->value() ) + string( " not found on that object" ); return new BError( message ); } else { return ret; } } else return new BError( "Invalid parameter type" ); break; } /// /// account.Ban() : bans the account. Disconnects connected client if any. /// case MTH_BAN: if ( ex.numParams() == 0 ) { obj_->banned_ = true; if ( obj_->active_character ) { if ( obj_->active_character->client ) obj_->active_character->client->Disconnect(); } } else return new BError( "account.Ban() doesn't take parameters." ); break; /// /// account.Unban() : unbans the account. /// case MTH_UNBAN: if ( ex.numParams() == 0 ) obj_->banned_ = false; else return new BError( "account.Unban() doesn't take parameters." ); break; /// /// account.Enable() : enables the account /// case MTH_ENABLE: if ( ex.numParams() == 0 ) obj_->enabled_ = true; else return new BError( "account.Enable() doesn't take parameters." ); break; /// /// account.Disable() : disables the account. Disconnects connected client if any. /// case MTH_DISABLE: if ( ex.numParams() == 0 ) { obj_->enabled_ = false; if ( obj_->active_character ) { if ( obj_->active_character->client ) obj_->active_character->client->Disconnect(); } break; } else return new BError( "account.Disable() doesn't take parameters." ); /// /// account.SetPassword( newpassword : string ) : changes the password.. /// case MTH_SETPASSWORD: if ( ex.numParams() == 1 ) { const String* pwstr; if ( ex.getStringParam( 0, pwstr ) ) { if ( Core::config.retain_cleartext_passwords ) obj_->password_ = pwstr->value(); std::string temp; Clib::MD5_Encrypt( obj_->name_ + pwstr->value(), temp ); obj_->passwordhash_ = temp; //MD5 break; } else { return new BError( "Invalid parameter type" ); } } else return new BError( "account.SetPassword(newpass) requires a parameter." ); /// /// account.CheckPassword( password : string ) : checks if the password is valid /// case MTH_CHECKPASSWORD: if ( ex.numParams() == 1 ) { const String* pwstr; if ( ex.getStringParam( 0, pwstr ) ) { bool ret; string temp; Clib::MD5_Encrypt( obj_->name_ + pwstr->value(), temp );//MD5 ret = Clib::MD5_Compare( obj_->passwordhash_, temp ); result = new BLong( ret ); } else { return new BError( "Invalid parameter type" ); } } else return new BError( "account.CheckPassword(password) requires a parameter." ); break; /// /// account.SetAcctName( newname : string ) : changes the account name /// - deprecated in favor of: /// account.SetName( newname : string ) : changes the account name /// ACK, bug - since account data is saved immediately, /// a crash w/o save will result in a server that can't start /// because account names in accounts.txt will refer to the old name /// case MTH_SETNAME: //passed only new account name, and cleartext password is saved if ( ( ex.numParams() == 1 ) && Core::config.retain_cleartext_passwords ) { const String* nmstr; if ( ex.getStringParam( 0, nmstr ) ) { if ( nmstr->value().empty() ) return new BError( "Account name must not be empty." ); std::string temp; //passing the new name, and recalc name+pass hash (pass only hash is unchanged) obj_->name_ = nmstr->value(); Clib::MD5_Encrypt( obj_->name_ + obj_->password_, temp ); obj_->passwordhash_ = temp; //MD5 } else { return new BError( "Invalid parameter type" ); } } //passed new account name and password else if ( ex.numParams() == 2 ) { const String* nmstr; const String* pwstr; if ( ex.getStringParam( 0, nmstr ) && ex.getStringParam( 1, pwstr ) ) { if ( nmstr->value().empty() ) return new BError( "Account name must not be empty." ); obj_->name_ = nmstr->value(); //this is the same as the "setpassword" code above if ( Core::config.retain_cleartext_passwords ) obj_->password_ = pwstr->value(); std::string temp; Clib::MD5_Encrypt( obj_->name_ + pwstr->value(), temp ); obj_->passwordhash_ = temp; //MD5 } else { return new BError( "Invalid parameter type" ); } } else if ( ( ex.numParams() == 1 ) && !Core::config.retain_cleartext_passwords ) return new BError( "Usage: account.SetName(name,pass) if RetainCleartextPasswords is off." ); else return new BError( "account.SetName needs at least 1 parameter." ); break; /// /// account.GetProp( propname : string ) : gets a custom account property /// returns Error( "Property not found" ) if property does not exist. /// /// /// account.SetProp( propname : string, propval : packable ) : sets a custom account property /// /// /// account.EraseProp( propname : string ) : erases a custom account property. /// /// /// account.PropNames() : array of property names /// case MTH_GETPROP: case MTH_SETPROP: case MTH_ERASEPROP: case MTH_PROPNAMES: { bool changed = false; result = CallPropertyListMethod_id( obj_->props_, id, ex, changed ); if ( result && !changed ) return result; break; } case MTH_SETDEFAULTCMDLEVEL: { if ( ex.numParams() != 1 ) return new BError( "account.SetDefaultCmdLevel(int) requires a parameter." ); int cmdlevel; if ( !ex.getParam( 0, cmdlevel ) ) return new BError( "Invalid parameter type." ); else if ( cmdlevel >= static_cast<int>( Core::cmdlevels2.size() ) ) cmdlevel = static_cast<int>( Core::cmdlevels2.size() - 1 ); obj_->default_cmdlevel_ = char( cmdlevel ); break; } /// /// account.GetCharacter( index : 1..5 ) : retrieve a reference to a character belonging to this account. /// This reference may be used even if the character is offline. case MTH_GETCHARACTER: { if ( ex.numParams() != 1 ) return new BError( "account.GetCharacter(index) requires a parameter." ); int index; if ( !ex.getParam( 0, index, 1, Core::config.character_slots ) ) return NULL; Mobile::Character* chr = obj_->get_character( index - 1 ); if ( chr == NULL ) return new BError( "No such character on this account" ); return new Module::EOfflineCharacterRefObjImp( chr ); } /// /// account.DeleteCharacter( index : 1..5 ) : delete a character /// character to be deleted cannot be logged in. /// case MTH_DELETECHARACTER: { if ( ex.numParams() != 1 ) return new BError( "account.DeleteCharacter(index) requires a parameter." ); int index; if ( !ex.getParam( 0, index, 1, Core::config.character_slots ) ) return NULL; Mobile::Character* chr = obj_->get_character( index - 1 ); if ( chr == NULL ) return new BError( "No such character on this account" ); if ( chr->client != NULL || chr->logged_in ) return new BError( "That character is in use" ); if ( can_delete_character( chr, Core::DELETE_BY_SCRIPT ) ) { call_ondelete_scripts( chr ); delete_character( obj_.Ptr(), chr, index - 1 ); } else return new BError( "CanDelete blocks Character deletion." ); break; } /// /// account.Set_UO_Expansion( string ) : recognized values: ML, SE, AOS, LBR, T2A (default) /// this determines what flag is sent with packet 0xB9 during login. /// case MTH_SET_UO_EXPANSION: if ( ex.numParams() != 1 ) return new BError( "account.Set_UO_Expansion(string) requires a parameter." ); const String* expansion_str; if ( ex.getStringParam( 0, expansion_str ) ) { if ( expansion_str->value().empty() || ( expansion_str->value() == "HSA" ) || ( expansion_str->value() == "SA" ) || ( expansion_str->value() == "KR" ) || ( expansion_str->value() == "ML" ) || ( expansion_str->value() == "SE" ) || ( expansion_str->value() == "AOS" ) || ( expansion_str->value() == "LBR" ) || ( expansion_str->value() == "T2A" ) ) { obj_->uo_expansion_ = obj_->convert_uo_expansion( expansion_str->value() ); if ( obj_->active_character ) Core::send_feature_enable( obj_->active_character->client ); } else return new BError( "Invalid Parameter Value. Supported Values: \"\", T2A, LBR, AOS, SE, ML, KR, SA, HSA" ); } else return new BError( "Invalid Parameter Type" ); break; /// /// account.Delete() : delete this account /// case MTH_DELETE: if ( ex.numParams() == 0 ) { int _result = delete_account( obj_->name() ); if ( _result == -1 ) return new BError( "You must delete all Character first." ); else if ( _result == -2 ) // Should never happen ;o) return new BError( "Invalid Account Name." ); } else return new BError( "account.Delete() doesn't take parameters." ); break; /// /// account.Split( newacctname : string, index : 1..5 ) : create a new account and move character to it /// case MTH_SPLIT: if ( ex.numParams() == 2 ) { const String* acctname; int index; if ( ex.getStringParam( 0, acctname ) && ex.getParam( 1, index, 1, Core::config.character_slots ) ) { if ( acctname->value().empty() ) return new BError( "Account name must not be empty." ); if ( find_account( acctname->data() ) ) return new BError( "Account already exists." ); Mobile::Character* chr = obj_->get_character( index - 1 ); if ( chr == NULL ) return new BError( "No such character on this account." ); if ( chr->client != NULL || chr->logged_in ) return new BError( "That character is in use." ); Account* account = duplicate_account( obj_->name_, acctname->value() ); if ( account != NULL ) { obj_->clear_character( index - 1 ); chr->acct.set( account ); account->set_character( 0, chr ); } else return new BError( "Was impossible to create new Account." ); } else return new BError( "Invalid parameter type." ); } else return new BError( "account.Split requires two parameters." ); break; /// /// account.Move_Char( destacctname : string, index : 1..5 ) : move character from this account to destaccount /// case MTH_MOVE_CHAR: if ( ex.numParams() == 2 ) { const String* acctname; int index; if ( ex.getStringParam( 0, acctname ) && ex.getParam( 1, index, 1, Core::config.character_slots ) ) { if ( acctname->value().empty() ) return new BError( "Account name must not be empty." ); Account* account = find_account( acctname->data() ); if ( account == NULL ) return new BError( "Account doesn't exists." ); Mobile::Character* chr = obj_->get_character( index - 1 ); if ( chr == NULL ) return new BError( "No such character on this account." ); if ( chr->client != NULL || chr->logged_in ) return new BError( "That character is in use." ); int charid = account->getnextfreeslot(); if ( charid != -1 ) { obj_->clear_character( index - 1 ); chr->acct.set( account ); account->set_character( charid - 1, chr ); } else return new BError( "Account is full." ); } else return new BError( "Invalid parameter type." ); } else return new BError( "account.Move_Char requires two parameters." ); break; case MTH_ADD_CHARACTER: { int index; if ( !ex.getParam( 0, index, 0, Core::config.character_slots ) ) return new BError( "Account.AddCharacter() requires one parameter." ); if ( index <= 0 ) { index = obj_->getnextfreeslot(); if ( index == -1 ) return new BError( "Account has no free character slots." ); } // We take in 1-5 to match account.GetCharacter() // Internally it uses it as 0-4 index--; if ( obj_->get_character( index ) ) { return new BError( "That character slot is already in use." ); } result = new BLong( index + 1 ); Account* acct = find_account( obj_->name_.c_str() ); if (acct == NULL) { return new BError("Account doesn't exist."); } Core::createchar2( acct, unsigned( index ) ); break; } default: return NULL; } // if any of the methods hit & worked, we'll come here if ( Core::config.account_save == -1 ) write_account_data(); else accounts_txt_dirty = true; return result ? result : new BLong( 1 ); }
void GroupsModel::Commit() { if (m_read_only) return; Account* account = MessageEngine::GetInstance()->GetAccountById(m_account_id); BOOL account_changed = FALSE; if (account) { account->StopFolderLoading(); UINT32 index_to_show = 0; for (int pos = 0; pos < GetItemCount(); pos++) { GroupsModelItem* item = GetItemByIndex(pos); if (item) { OpString path, name; OpStatus::Ignore(item->GetPath(path)); OpStatus::Ignore(item->GetName(name)); if (item->PathIsChanged() && !item->IsManuallyAdded()) { OpString old_path; OpStatus::Ignore(item->GetOldPath(old_path)); OpStatus::Ignore(account->RenameFolder(old_path, path)); } if (item->SubscriptionIsChanged()) { if (item->IsManuallyAdded()) { OpStatus::Ignore(account->CreateFolder(path, item->GetIsSubscribed())); } if (item->GetIsSubscribed()) { OpStatus::Ignore(account->AddSubscribedFolder(path)); account->SetIsTemporary(FALSE); if (m_folder_type != OpTypedObject::IMAPFOLDER_TYPE) { Index* index = MessageEngine::GetInstance()->GetIndexer()->GetSubscribedFolderIndex(account, path, 0, name, TRUE, FALSE); if (index) { MessageEngine::GetInstance()->RefreshFolder(index->GetId()); if (index_to_show) index_to_show = IndexTypes::FIRST_ACCOUNT + m_account_id; else index_to_show = index->GetId(); } } } else { Index* index = MessageEngine::GetInstance()->GetIndexer()->GetSubscribedFolderIndex(account, path, 0, name, FALSE, FALSE); if (index) OpStatus::Ignore(account->RemoveSubscribedFolder(index->GetId())); else OpStatus::Ignore(account->RemoveSubscribedFolder(path)); } account_changed = TRUE; } else if (item->GetIsSubscribed() && m_folder_type != OpTypedObject::IMAPFOLDER_TYPE) { MessageEngine::GetInstance()->GetIndexer()->GetSubscribedFolderIndex(account, path, 0, name, TRUE, FALSE); } } } if (account_changed) { account->CommitSubscribedFolders(); } if (index_to_show) { g_application->GoToMailView(index_to_show, NULL, NULL, TRUE, FALSE, TRUE); } } }
OP_STATUS AccountManager::Init(OpString8& status) { if (!m_prefs_file) return OpStatus::ERR; const char *accounts_str = "Accounts"; int account_count, accounts_version; RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Count", 0, account_count)); RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Version", -1, accounts_version)); // if we have no information, we simply must assume it's the current version if (accounts_version == -1) { m_old_version = CURRENT_M2_ACCOUNT_VERSION; accounts_version = CURRENT_M2_ACCOUNT_VERSION; RETURN_IF_ERROR(PrefsUtils::WritePrefsInt(m_prefs_file, accounts_str, "Version", CURRENT_M2_ACCOUNT_VERSION)); } if (accounts_version > CURRENT_M2_ACCOUNT_VERSION && account_count) { status.Append("Not possible to run old Opera version with new Opera mail files.\r\n"); return OpStatus::ERR; // refuse to start } if (accounts_version < CURRENT_M2_ACCOUNT_VERSION) { m_old_version = accounts_version; RETURN_IF_ERROR(PrefsUtils::WritePrefsInt(m_prefs_file, accounts_str, "Version", CURRENT_M2_ACCOUNT_VERSION)); } INT32 default_mail_account; RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Next Available Id" , 1, m_next_available_account_id)); RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default Mail Account" , 0, m_last_used_mail_account)); RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default Outgoing Mail Account", 0, default_mail_account)); RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default News Account" , 0, m_default_news_account)); RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default Chat Account" , 0, m_default_chat_account)); m_default_mail_account.Set(default_mail_account); m_default_mail_account.Subscribe(MAKE_DELEGATE(*this, &AccountManager::CommitDefaultMailAccount)); if (m_active_account!=-1) //Category is only available for active account -1 ('custom category') m_active_category.Empty(); UINT16 account_id = 0; OpINTSortedVector valid_account_ids; char account_key[13]; OP_STATUS ret; for (UINT16 i=1; i<=account_count; i++) { op_sprintf(account_key, "Account%u", i); // first get the account id RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, account_key, 0, account_id)); OpString8 account_section; RETURN_IF_ERROR(account_section.AppendFormat("Account%d", account_id));; OpString8 protocol; RETURN_IF_ERROR(PrefsUtils::ReadPrefsString(m_prefs_file, account_section, "Incoming Protocol", protocol)); // check if it's a known type or an old unsupported type if (Account::GetProtocolFromName(protocol) == AccountTypes::UNDEFINED) continue; if (account_id != 0) { Account* account = OP_NEW(Account, (m_database)); if (!account) return OpStatus::ERR_NO_MEMORY; Account* does_it_exist = NULL; if (OpStatus::IsError(ret=GetAccountById(account_id, does_it_exist))) { OP_DELETE(account); return ret; } if (does_it_exist) { OP_DELETE(account); return OpStatus::ERR; //Already exists in list! } account->Into(&m_accountlist); if (OpStatus::IsError(ret=account->Init(account_id, status))) { status.Append("Initializing "); status.Append(account_key); status.Append(" failed\n"); return ret; } if (account->GetIsTemporary()) { UINT16* temporary_id = OP_NEW(UINT16, ()); if(!temporary_id) return OpStatus::ERR_NO_MEMORY; *temporary_id = account->GetAccountId(); m_temporary_accounts.Add(temporary_id); } else {
qint64 UDSUtil::addAccount(QString name, QString displayName, QString serverName, QString target, QString icon, QString lockedIcon, QString composeIcon, QString desc, bool compose, uds_account_type_t type) { int retCode = -1; uds_account_key_t accountId; char accountName[256]; char targetName[256]; char iconName[256]; char lockedIconName[256]; char composeIconName[256]; char description[256]; Account act; AccountService accountService; QString s; char *p = 0; if (!_isRegistrationSuccess) { qCritical() << "UDSUtil::addAccount: not registered yet\n"; return -1; } memset(accountName, 0, 256); strncpy(accountName, name.toUtf8().data(), 255); memset(targetName, 0, 256); strncpy(targetName, target.toUtf8().data(), 255); memset(iconName, 0, 256); strncpy(iconName, icon.toUtf8().data(), 255); memset(lockedIconName, 0, 256); strncpy(lockedIconName, lockedIcon.toUtf8().data(), 255); memset(composeIconName, 0, 256); strncpy(composeIconName, composeIcon.toUtf8().data(), 255); memset(description, 0, 256); strncpy(description, desc.toUtf8().data(), 255); if (_itemPerimeterType == UDS_PERIMETER_ENTERPRISE) { displayName.append("-Work"); } // check for existing account and use that accountID as a starting point QList<Account> allAccounts; do { allAccounts = accountService.accounts(); qDebug() << "UDSUtil::addAccount: # accounts: " << allAccounts.length(); if (allAccounts.length() > 0) { for(int index = 0; index < allAccounts.length(); index++) { Account account = allAccounts.at(index); //char *accountName = (char *)account.displayName().toUtf8().constData(); qDebug() << "UDSUtil: addAccount: check account " << index << " : " << account.displayName() << account.isServiceSupported(Service::Messages) << " : " << account.provider().id(); if (_itemPerimeterType == UDS_PERIMETER_ENTERPRISE) { account.setExternalEnterprise (Property::Enterprise); if (account.displayName() == displayName && account.provider().id() == "external" && account.isEnterprise() == Property::Enterprise) { _nextAccountId = account.id(); qDebug() << "UDSUtil: addAccount: found existing account " << _nextAccountId; } } else { if (account.displayName() == displayName && account.provider().id() == "external") { _nextAccountId = account.id(); qDebug() << "UDSUtil: addAccount: found existing account " << _nextAccountId; } } } } } while (allAccounts.length() == 0); // create the message service account if (_nextAccountId != 0) { cleanupAccountsExcept(_nextAccountId, displayName); accountService.updateAccount (act.id(), act); } else { QString providerId("external"); // this maps to the filename of the provider's json file const Provider provider = accountService.provider(providerId); Account account(provider); account.setExternalData(true); if (_itemPerimeterType == UDS_PERIMETER_ENTERPRISE) { account.setExternalEnterprise (Property::Enterprise); } account.setSettingsValue("server", serverName); account.setDisplayName(displayName); Result r = accountService.createAccount(provider.id(), account); if (!r.isSuccess()) { s = r.message(); p = s.toUtf8().data(); qCritical() << "UDSUtil::addAccount: account create failed !"<<s<<p<<account.isValid(); act = Account(); } else { // Was successful, so lets get the account id AccountKey id = account.id(); qDebug() << "UDSUtil::addAccount: account created with id "<<id<<account.isValid(); act = account; } if( act.isValid() ){ _nextAccountId = act.id(); }else{ _nextAccountId = 0; } } qDebug() << "UDSUtil: addAccount: _udsHandle " << _udsHandle; // create the UDS account uds_account_data_t *accountData = uds_account_data_create(); uds_account_data_set_id(accountData,_nextAccountId); uds_account_data_set_name(accountData,accountName); uds_account_data_set_icon(accountData, iconName); uds_account_data_set_locked_icon(accountData,lockedIconName); uds_account_data_set_description(accountData, description); uds_account_data_set_compose_icon(accountData, composeIconName); uds_account_data_set_supports_compose(accountData,compose); uds_account_data_set_type(accountData, type); uds_account_data_set_target_name(accountData, targetName); if (0 != (retCode = uds_account_added(_udsHandle, accountData))) { qCritical() << "UDSUtil::addAccount: uds_account_added failed with error " << retCode << " for account: " << name << "\n"; accountId = -1; } else { if (_nextAccountId == 0) { _nextAccountId++; } accountId = _nextAccountId; //mapAccount[name] = uds_account_data_get_id(accountData); qDebug() << "UDSUtil::addAccount: account: " << name << ": added, id" << QString::number(_nextAccountId); _nextAccountId++; } if (_async) { retCode = uds_get_response(_udsHandle); } uds_account_data_destroy(accountData); return accountId; }
void SystemAccounttest::test_store() { m_account->store(); }
void UDSUtil::cleanupAccountsExcept(const qint64 accountId, const QString& name) { qDebug() << "UDSUtil::cleanupAccountsExcept : name : " << name << " : accountId: " << accountId; int accRemoved = 0; if (accountId != -1) { QString s; char *p = 0; Account act; AccountService accountService; QString providerId("external"); const Provider provider = accountService.provider(providerId); QList<Account> allAccounts; do { allAccounts = accountService.accounts(); qDebug() << "UDSUtil::cleanupAccountsExcept: # accounts: " << allAccounts.length(); if (allAccounts.length() > 0) { //JsonDataAccess jda; for(int index = 0; index < allAccounts.length(); index++) { Account account = allAccounts.at(index); QByteArray rawBuffer; if (account.displayName() == name) { qDebug() << "UDSUtil: cleanupAccountsExcept: account " << index << "\n : Account ID: " << account.id() << "\n : Account Name: " << account.displayName() << "\n : Invoke Target: " << account.externalSetupInvokeTarget() << "\n : Messages supported: " << account.isServiceSupported(Service::Messages) << "\n : Provider ID: " << account.provider().id(); qint64 accId = account.id(); if (accId != accountId) { removeAccount(accId); Result r = accountService.deleteAccount(accId); qDebug() << "UDSUtil::cleanupAccountsExcept : Removing account..."; if (!r.isSuccess()) { s = r.message(); p = s.toUtf8().data(); qCritical() << "UDSUtil::cleanupAccountsExcept : account remove failed !"<<s<<p<<account.isValid(); act = Account(); } else { // Was successful, so lets get the account id qDebug() << "UDSUtil::cleanupAccountsExcept: account with id "<<accId<< " removed"; act = account; accRemoved++; } } } } } // in case service does not start up right away, retry until it becomes available //usleep(5000); } while (allAccounts.length() == 0); } else { qCritical() << "UDSUtil::cleanupAccountsExcept : No account id, aborting."; } qDebug() << "UDSUtil::cleanupAccountsExcept: Accounts Removed: " << accRemoved; }
void Prefs::saveAccount(int accNumber) { Account* acc = accounts.at(accNumber); acc->save(); }
int main(int argc, char **argv) { QCoreApplication app(argc, argv); CmdOptions options; options.silent = false; options.trustSSL = false; options.useNetrc = false; options.interactive = true; ClientProxy clientProxy; parseOptions( app.arguments(), &options ); QUrl url = QUrl::fromUserInput(options.target_url); // Fetch username and password. If empty, try to retrieve // from URL and strip URL QString user; QString password; if (options.useNetrc) { NetrcParser parser; if (parser.parse()) { NetrcParser::LoginPair pair = parser.find(url.host()); user = pair.first; password = pair.second; } } else { user = options.user; if (user.isEmpty()) { user = url.userName(); } password = options.password; if (password.isEmpty()) { password = url.password(); } if (options.interactive) { if (user.isEmpty()) { std::cout << "Please enter user name: "; std::string s; std::getline(std::cin, s); user = QString::fromStdString(s); } if (password.isEmpty()) { password = queryPassword(user); } } } // ### ensure URL is free of credentials if (url.userName().isEmpty()) { url.setUserName(user); } if (url.password().isEmpty()) { url.setPassword(password); } Account account; // Find the folder and the original owncloud url QStringList splitted = url.path().split(account.davPath()); url.setPath(splitted.value(0)); url.setScheme(url.scheme().replace("owncloud", "http")); QString folder = splitted.value(1); SimpleSslErrorHandler *sslErrorHandler = new SimpleSslErrorHandler; HttpCredentials *cred = new HttpCredentialsText(user, password); account.setUrl(url); account.setCredentials(cred); account.setSslErrorHandler(sslErrorHandler); AccountManager::instance()->setAccount(&account); restart_sync: CSYNC *_csync_ctx; if( csync_create( &_csync_ctx, options.source_dir.toUtf8(), url.toEncoded().constData()) < 0 ) { qFatal("Unable to create csync-context!"); return EXIT_FAILURE; } int rc = ne_sock_init(); if (rc < 0) { qFatal("ne_sock_init failed!"); } csync_set_log_level(options.silent ? 1 : 11); opts = &options; cred->syncContextPreInit(_csync_ctx); if( csync_init( _csync_ctx ) < 0 ) { qFatal("Could not initialize csync!"); return EXIT_FAILURE; } csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx); if( !options.proxy.isNull() ) { QString host; int port = 0; bool ok; // Set as default and let overwrite later csync_set_module_property(_csync_ctx, "proxy_type", (void*) "NoProxy"); QStringList pList = options.proxy.split(':'); if(pList.count() == 3) { // http: //192.168.178.23 : 8080 // 0 1 2 host = pList.at(1); if( host.startsWith("//") ) host.remove(0, 2); port = pList.at(2).toInt(&ok); if( !host.isNull() ) { csync_set_module_property(_csync_ctx, "proxy_type", (void*) "HttpProxy"); csync_set_module_property(_csync_ctx, "proxy_host", host.toUtf8().data()); if( ok && port ) { csync_set_module_property(_csync_ctx, "proxy_port", (void*) &port); } } } } else { clientProxy.setupQtProxyFromConfig(); QString url( options.target_url ); if( url.startsWith("owncloud")) { url.remove(0, 8); url = QString("http%1").arg(url); } clientProxy.setCSyncProxy(QUrl(url), _csync_ctx); } if (!options.exclude.isEmpty()) { csync_add_exclude_list(_csync_ctx, options.exclude.toLocal8Bit()); } cred->syncContextPreStart(_csync_ctx); Cmd cmd; SyncJournalDb db(options.source_dir); SyncEngine engine(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db); QObject::connect(&engine, SIGNAL(finished()), &app, SLOT(quit())); QObject::connect(&engine, SIGNAL(transmissionProgress(Progress::Info)), &cmd, SLOT(transmissionProgressSlot())); // Have to be done async, else, an error before exec() does not terminate the event loop. QMetaObject::invokeMethod(&engine, "startSync", Qt::QueuedConnection); app.exec(); csync_destroy(_csync_ctx); ne_sock_exit(); if (engine.isAnotherSyncNeeded()) { qDebug() << "Restarting Sync, because another sync is needed"; goto restart_sync; } return 0; }
virtual void makeBody(GDynamicPageSession* pSession, ostream& response) { Account* pAccount = getAccount(pSession); if(pSession->paramsLen() >= 0) { // See if the user wants to log out GHttpParamParser params(pSession->params()); const char* szAction = params.find("action"); if(szAction) { if(_stricmp(szAction, "logout") == 0) { m_pServer->redirect(response, "/main.hbody"); pSession->setExtension(NULL); // disconnect the account from this session return; } else response << "Unrecognized action: " << szAction << "<br><br>\n\n"; } // Check the password const char* szUsername = params.find("username"); const char* szPasswordHash = params.find("password"); if(szUsername) { Account* pNewAccount = m_pServer->loadAccount(szUsername, szPasswordHash); if(pNewAccount) { string s; if(pAccount) { if(strlen(pAccount->afterLoginUrl()) > 0) s = pAccount->afterLoginUrl(); if(strlen(pAccount->afterLoginParams()) > 0) { s += "?"; s += pAccount->afterLoginParams(); } if(s.length() < 1) { s = "/main.hbody?"; s += gformat((size_t)m_pServer->prng()->next()); // ensure no caching } } else { s = "/main.hbody"; s += gformat((size_t)m_pServer->prng()->next()); // ensure no caching } // Log in with the new account pSession->setExtension(pNewAccount); m_pServer->redirect(response, s.c_str()); } else response << "<big><big>Incorrect Password! Please try again</big></big><br><br>\n"; } } response << "<br><br>\n"; response << "<SCRIPT language=\"JavaScript\" src=\"/sha1.js\" type=\"text/javascript\">\n</SCRIPT>\n"; if(pAccount) { response << "Your current username is: " << pAccount->username() << ".<br>\n"; if(pAccount->doesHavePassword()) response << "Click here to <a href=\"/login?action=logout\">log out</a>.<br>\n"; response << "Log in as a different user:<br>\n"; } else response << "Please enter credentials to log in:<br>\n"; response << "<form name=\"loginform\" action=\"/login\" method=\"get\" onsubmit=\"return HashPassword('"; response << m_pServer->passwordSalt(); response << "')\">\n"; response << " Username:<input type=\"text\" name=\"username\" ><br>\n"; response << " Password:<input type=\"password\" name=\"password\" ><br>\n"; response << " <input type=\"submit\" value=\"Log In\">\n"; response << "</form><br><br>\n\n"; response << "or click here to <a href=\"/newaccount\">create a new account</a><br><br>\n"; }
int main(){ Account *normalAccount = new NormalAccount(50000); normalAccount->toString(); normalAccount->withdraw(40000); normalAccount->toString(); cout << endl; Account *minusAccount = new MinusAccount(50000, 100000); minusAccount->toString(); minusAccount->withdraw(40000); minusAccount->toString(); minusAccount->withdraw(150000); minusAccount->toString(); cout << endl; Account *savingAccount = new SavingAccount(50000, 2015, 10, 10); savingAccount->toString(); savingAccount->withdraw(40000); savingAccount->toString(); return 0; }
int PathRequest::parseJson (const Json::Value& jvParams, bool complete) { int ret = PFR_PJ_NOCHANGE; if (jvParams.isMember ("source_account")) { if (!raSrcAccount.setAccountID (jvParams["source_account"].asString ())) { jvStatus = rpcError (rpcSRC_ACT_MALFORMED); return PFR_PJ_INVALID; } } else if (complete) { jvStatus = rpcError (rpcSRC_ACT_MISSING); return PFR_PJ_INVALID; } if (jvParams.isMember ("destination_account")) { if (!raDstAccount.setAccountID (jvParams["destination_account"].asString ())) { jvStatus = rpcError (rpcDST_ACT_MALFORMED); return PFR_PJ_INVALID; } } else if (complete) { jvStatus = rpcError (rpcDST_ACT_MISSING); return PFR_PJ_INVALID; } if (jvParams.isMember ("destination_amount")) { if (!saDstAmount.bSetJson (jvParams["destination_amount"]) || (saDstAmount.getCurrency ().isZero () && saDstAmount.getIssuer ().isNonZero ()) || (saDstAmount.getCurrency () == badCurrency()) || saDstAmount <= zero) { jvStatus = rpcError (rpcDST_AMT_MALFORMED); return PFR_PJ_INVALID; } } else if (complete) { jvStatus = rpcError (rpcDST_ACT_MISSING); return PFR_PJ_INVALID; } if (jvParams.isMember ("source_currencies")) { const Json::Value& jvSrcCur = jvParams["source_currencies"]; if (!jvSrcCur.isArray ()) { jvStatus = rpcError (rpcSRC_CUR_MALFORMED); return PFR_PJ_INVALID; } sciSourceCurrencies.clear (); for (unsigned i = 0; i < jvSrcCur.size (); ++i) { const Json::Value& jvCur = jvSrcCur[i]; Currency uCur; Account uIss; if (!jvCur.isObject() || !jvCur.isMember ("currency") || !to_currency (uCur, jvCur["currency"].asString ())) { jvStatus = rpcError (rpcSRC_CUR_MALFORMED); return PFR_PJ_INVALID; } if (jvCur.isMember ("issuer") && !to_issuer (uIss, jvCur["issuer"].asString ())) { jvStatus = rpcError (rpcSRC_ISR_MALFORMED); } if (uCur.isZero () && uIss.isNonZero ()) { jvStatus = rpcError (rpcSRC_CUR_MALFORMED); return PFR_PJ_INVALID; } sciSourceCurrencies.insert ({uCur, uIss}); } } if (jvParams.isMember ("id")) jvId = jvParams["id"]; return ret; }
std::ostream& dev::eth::operator<<(std::ostream& _out, State const& _s) { _out << "--- " << _s.rootHash() << std::endl; std::set<Address> d; std::set<Address> dtr; auto trie = TrieDB<Address, OverlayDB>(const_cast<OverlayDB*>(&_s.m_db), _s.rootHash()); for (auto i: trie) d.insert(i.first), dtr.insert(i.first); for (auto i: _s.m_cache) d.insert(i.first); for (auto i: d) { auto it = _s.m_cache.find(i); Account* cache = it != _s.m_cache.end() ? &it->second : nullptr; string rlpString = dtr.count(i) ? trie.at(i) : ""; RLP r(rlpString); assert(cache || r); if (cache && !cache->isAlive()) _out << "XXX " << i << std::endl; else { string lead = (cache ? r ? " * " : " + " : " "); if (cache && r && cache->nonce() == r[0].toInt<u256>() && cache->balance() == r[1].toInt<u256>()) lead = " . "; stringstream contout; if ((cache && cache->codeBearing()) || (!cache && r && (h256)r[3] != EmptySHA3)) { std::map<u256, u256> mem; std::set<u256> back; std::set<u256> delta; std::set<u256> cached; if (r) { TrieDB<h256, OverlayDB> memdb(const_cast<OverlayDB*>(&_s.m_db), r[2].toHash<h256>()); // promise we won't alter the overlay! :) for (auto const& j: memdb) mem[j.first] = RLP(j.second).toInt<u256>(), back.insert(j.first); } if (cache) for (auto const& j: cache->storageOverlay()) { if ((!mem.count(j.first) && j.second) || (mem.count(j.first) && mem.at(j.first) != j.second)) mem[j.first] = j.second, delta.insert(j.first); else if (j.second) cached.insert(j.first); } if (!delta.empty()) lead = (lead == " . ") ? "*.* " : "*** "; contout << " @:"; if (!delta.empty()) contout << "???"; else contout << r[2].toHash<h256>(); if (cache && cache->isFreshCode()) contout << " $" << toHex(cache->code()); else contout << " $" << (cache ? cache->codeHash() : r[3].toHash<h256>()); for (auto const& j: mem) if (j.second) contout << std::endl << (delta.count(j.first) ? back.count(j.first) ? " * " : " + " : cached.count(j.first) ? " . " : " ") << std::hex << nouppercase << std::setw(64) << j.first << ": " << std::setw(0) << j.second ; else contout << std::endl << "XXX " << std::hex << nouppercase << std::setw(64) << j.first << ""; } else contout << " [SIMPLE]"; _out << lead << i << ": " << std::dec << (cache ? cache->nonce() : r[0].toInt<u256>()) << " #:" << (cache ? cache->balance() : r[1].toInt<u256>()) << contout.str() << std::endl; } } return _out; }
void AccountContainer::updateItem(const Account& account) { ScopedWriteLock lock(read_write_mutex_); account_container_[account.getAccountID()] = account; }
/** * DownloadRepoRequest */ DownloadRepoRequest::DownloadRepoRequest(const Account& account, const QString& repo_id, bool read_only) : SeafileApiRequest(account.getAbsoluteUrl("api2/repos/" + repo_id + "/download-info/"), SeafileApiRequest::METHOD_GET, account.token), read_only_(read_only) { }