/** Loads the saved Message Log settings */ void MessageLog::loadSettings() { /* Set Max Count widget */ uint maxMsgCount = getSetting(SETTING_MAX_MSG_COUNT, DEFAULT_MAX_MSG_COUNT).toUInt(); ui.spnbxMaxCount->setValue(maxMsgCount); ui.listMessages->setMaximumMessageCount(maxMsgCount); ui.listNotifications->setMaximumItemCount(maxMsgCount); /* Set whether or not logging to file is enabled */ _enableLogging = getSetting(SETTING_ENABLE_LOGFILE, DEFAULT_ENABLE_LOGFILE).toBool(); QString logfile = getSetting(SETTING_LOGFILE, DEFAULT_LOGFILE).toString(); ui.lineFile->setText(QDir::convertSeparators(logfile)); rotateLogFile(logfile); ui.chkEnableLogFile->setChecked(_logFile.isOpen()); /* Set the checkboxes accordingly */ _filter = getSetting(SETTING_MSG_FILTER, DEFAULT_MSG_FILTER).toUInt(); ui.chkTorErr->setChecked(_filter & tc::ErrorSeverity); ui.chkTorWarn->setChecked(_filter & tc::WarnSeverity); ui.chkTorNote->setChecked(_filter & tc::NoticeSeverity); ui.chkTorInfo->setChecked(_filter & tc::InfoSeverity); ui.chkTorDebug->setChecked(_filter & tc::DebugSeverity); registerLogEvents(); /* Filter the message log */ QApplication::setOverrideCursor(Qt::WaitCursor); ui.listMessages->filter(_filter); QApplication::restoreOverrideCursor(); }
//------------------------------------------------------------------------------ ImpactObject::ImpactObject(const Setting &setting, Domain *domain): Modifier(domain) { startTime = getSetting(setting, {"startTime"}); endTime = getSetting(setting, {"endTime"}); ks = getSetting(setting, {"ks"}); R = getSetting(setting, {"R"}); velocity = getSetting(setting, {"velocity"}); // Dimensionless scaling // f = F/V^2 = -ks(r' - R')^2 /L0^4 // f' = f L0^4 / E0 = -ks/E0 (r' - R')^2 // // OR // // F = -ks'(r' - R')^2 E0 L0^2 // b = F/V = -ks(r - R)^2 / V // b = -ks'(r' - R')^2 / V' E0/L0 // b' = -ks'(r' - R')^ 2 / V' const Scaling &scaling = domain->scaling(); if(scaling.dimensionlessScaling) { ks /= scaling.E; R /= scaling.L; velocity /= scaling.V; } // Setting the center of the sphere double spacing = domain->latticeSpacing(); centerOfSphere[X] = domain->getDomain()[X][1] + R - 0.5*spacing; centerOfSphere[Y] = 0.5*( domain->getDomain()[Y][1] - domain->getDomain()[Y][0] ); centerOfSphere[Z] = 0.5*( domain->getDomain()[Z][1] - domain->getDomain()[Z][0] ); tPrev = 0; // TODO: should be initial time. }
void TTSFestival::updateVoiceList() { QStringList voiceList = getVoiceList(getSetting(eSERVERPATH)->current().toString()); getSetting(eVOICE)->setList(voiceList); if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0)); else getSetting(eVOICE)->setCurrent(""); }
bool Dropbox::writeFile(QByteArray &data, QString remotename, RideFile *ride) { Q_UNUSED(ride); // this must be performed asyncronously and call made // to notifyWriteCompleted(QString remotename, QString message) when done // do we have a token ? QString token = getSetting(GC_DROPBOX_TOKEN, "").toString(); if (token == "") return false; // is the path set ? QString path = getSetting(GC_DROPBOX_FOLDER, "").toString(); if (path == "") return false; // lets connect and get basic info on the root directory QString url("https://content.dropboxapi.com/1/files_put/auto/" + path + "/" + remotename + "?overwrite=true&autorename=false"); // request using the bearer token QNetworkRequest request(url); request.setRawHeader("Authorization", (QString("Bearer %1").arg(token)).toLatin1()); // put the file QNetworkReply *reply = nam->put(request, data); // catch finished signal connect(reply, SIGNAL(finished()), this, SLOT(writeFileCompleted())); // remember mapReply(reply,remotename); return true; }
//------------------------------------------------------------------------------ InitialFromImage::InitialFromImage(const Setting& parameters): InitialConfiguration(parameters) { const Setting & latticePoints = getSetting(parameters, {"initialConfiguration", "latticePoints"}); // Setting the intial grid size and dimension nParticles = 1; dim = latticePoints.getLength(); nXYZ.zeros(); for(int d=0; d<dim; d++) { nXYZ[d] = latticePoints[d]; nParticles *= nXYZ[d]; } // Setting the domain vector<VEC2> dom; for(int i=0; i<dim; i++) { VEC2 iDomain; iDomain = { 0 , spacing*nXYZ[i]}; dom.push_back(iDomain); } domain.setDomain(dom); string pathXZ = getSetting(parameters, {"initialConfiguration", "pathXZ"}); }
void init_ui(int *argcp, char ***argvp) { QVariant v; application = new QApplication(*argcp, *argvp); // the Gtk theme makes things unbearably ugly // so switch to Oxygen in this case if (application->style()->objectName() == "gtk+") application->setStyle("Oxygen"); #if QT_VERSION < 0x050000 // ask QString in Qt 4 to interpret all char* as UTF-8, // like Qt 5 does. // 106 is "UTF-8", this is faster than lookup by name // [http://www.iana.org/assignments/character-sets/character-sets.xml] QTextCodec::setCodecForCStrings(QTextCodec::codecForMib(106)); #endif QCoreApplication::setOrganizationName("Subsurface"); QCoreApplication::setOrganizationDomain("subsurface.hohndel.org"); QCoreApplication::setApplicationName("Subsurface"); QSettings s; s.beginGroup("GeneralSettings"); prefs.default_filename = getSetting(s, "default_filename"); s.endGroup(); s.beginGroup("DiveComputer"); default_dive_computer_vendor = getSetting(s, "dive_computer_vendor"); default_dive_computer_product = getSetting(s,"dive_computer_product"); default_dive_computer_device = getSetting(s, "dive_computer_device"); s.endGroup(); return; }
// Apply per-site settings when going to new sites static void persite(webview * const view, const char * const url) { tab * const cur = findtab(view); if (!cur || cur->state != TS_WEB) return; char site[120]; url2site(url, site, 120, true); setting *s = NULL; if (cur->js == TRI_AUTO) { s = getSetting("general.javascript", site); view->setBool(WK_SETTING_JS, s->val.u); } if (cur->css == TRI_AUTO) { s = getSetting("general.css", site); view->setBool(WK_SETTING_CSS, s->val.u); } if (cur->img == TRI_AUTO) { s = getSetting("general.images", site); view->setBool(WK_SETTING_IMG, s->val.u); } s = getSetting("general.localstorage", site); view->setBool(WK_SETTING_LOCALSTORAGE, s->val.u); s = getSetting("user.css", site); view->setChar(WK_SETTING_USER_CSS, s->val.c); }
// open by connecting and getting a basic list of folders available bool PolarFlow::open(QStringList &errors) { printd("PolarFlow::open\n"); // do we have a token QString token = getSetting(GC_POLARFLOW_TOKEN, "").toString(); if (token == "") { errors << "You must authorise with PolarFlow first"; return false; } // use the configed URL QString url = QString("%1/rest/users/delegates/users") .arg(getSetting(GC_POLARFLOW_URL, "https://whats.todaysplan.com.au").toString()); printd("URL used: %s\n", url.toStdString().c_str()); // request using the bearer token QNetworkRequest request(url); request.setRawHeader("Authorization", (QString("Bearer %1").arg(token)).toLatin1()); QNetworkReply *reply = nam->get(request); // blocking request QEventLoop loop; connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); if (reply->error() != QNetworkReply::NoError) { qDebug() << "error" << reply->errorString(); errors << tr("Network Problem reading PolarFlow data"); return false; } // did we get a good response ? QByteArray r = reply->readAll(); printd("response: %s\n", r.toStdString().c_str()); QJsonParseError parseError; QJsonDocument document = QJsonDocument::fromJson(r, &parseError); // if path was returned all is good, lets set root if (parseError.error == QJsonParseError::NoError) { printd("NoError"); // we have a root root_ = newCloudServiceEntry(); // path name root_->name = "/"; root_->isDir = true; root_->size = 0; } else { errors << tr("problem parsing PolarFlow data"); } // ok so far ? if (errors.count()) return false; return true; }
// read a file at location (relative to home) into passed array bool PolarFlow::readFile(QByteArray *data, QString remotename, QString remoteid) { printd("PolarFlow::readFile(%s)\n", remotename.toStdString().c_str()); // this must be performed asyncronously and call made // to notifyReadComplete(QByteArray &data, QString remotename, QString message) when done // do we have a token ? QString token = getSetting(GC_POLARFLOW_TOKEN, "").toString(); if (token == "") return false; // lets connect and get basic info on the root directory QString url = QString("%1/rest/files/download/%2") .arg(getSetting(GC_POLARFLOW_URL, "https://whats.todaysplan.com.au").toString()) .arg(remoteid); printd("url:%s\n", url.toStdString().c_str()); // request using the bearer token QNetworkRequest request(url); request.setRawHeader("Authorization", (QString("Bearer %1").arg(token)).toLatin1()); // put the file QNetworkReply *reply = nam->get(request); // remember mapReply(reply,remotename); buffers.insert(reply,data); // catch finished signal connect(reply, SIGNAL(finished()), this, SLOT(readFileCompleted())); connect(reply, SIGNAL(readyRead()), this, SLOT(readyRead())); return true; }
/** Restores the last size and location of the window. */ void VidaliaWindow::restoreWindowState() { #if QT_VERSION >= 0x040200 QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray(); if (geometry.isEmpty()) adjustSize(); else restoreGeometry(geometry); #else QRect screen = QDesktopWidget().availableGeometry(); /* Restore the window size. */ QSize size = getSetting("Size", QSize()).toSize(); if (!size.isEmpty()) { size = size.boundedTo(screen.size()); resize(size); } /* Restore the window position. */ QPoint pos = getSetting("Position", QPoint()).toPoint(); if (!pos.isNull() && screen.contains(pos)) { move(pos); } #endif }
//------------------------------------------------------------------------------ SimplePdFracture::SimplePdFracture(const Setting ¶meters, Domain *domain): FractureCriterion(domain) { (void) parameters; alpha = getSetting(parameters, {"alpha"}); compressiveScaleFactor = getSetting(parameters, {"compressiveScaleFactor"}); }
LocationWatcher::LocationWatcher(QObject *parent) : QObject(parent) { openDB(); source = QGeoPositionInfoSource::createDefaultSource(this); setinterval(getSetting("time")); setgpsmode(getSetting("usegps")); }
void TTSSapi::updateVoiceList() { qDebug() << "update voiceList"; QStringList voiceList = getVoiceList(getSetting(eLANGUAGE)->current().toString()); getSetting(eVOICE)->setList(voiceList); if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0)); else getSetting(eVOICE)->setCurrent(""); }
void TTSFestival::saveSettings() { //save settings in user config RbSettings::setSubValue("festival-server",RbSettings::TtsPath,getSetting(eSERVERPATH)->current().toString()); RbSettings::setSubValue("festival-client",RbSettings::TtsPath,getSetting(eCLIENTPATH)->current().toString()); RbSettings::setSubValue("festival",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString()); RbSettings::sync(); }
CameraSettings CameraIIDC::getCameraSettings(){ // Get settings: CameraSettings settings; settings.gain = getSetting(cam, DC1394_FEATURE_GAIN); settings.shutter = getSetting(cam, DC1394_FEATURE_SHUTTER); return settings; }
void TTSFestival::updateVoiceDescription() { // get voice Info with current voice and path currentPath = getSetting(eSERVERPATH)->current().toString(); QString info = getVoiceInfo(getSetting(eVOICE)->current().toString()); currentPath = ""; getSetting(eVOICEDESC)->setCurrent(info); }
void GeneralSettingsPage::apply() { auto language = language_box->currentData(); if (language != getSetting(Settings::General_Language) || translation_file != getSetting(Settings::General_TranslationFile).toString()) { // Show an message box in the new language. TranslationUtil translation((QLocale::Language)language.toInt(), translation_file); auto new_language = translation.getLocale().language(); switch (new_language) { case QLocale::AnyLanguage: case QLocale::C: case QLocale::English: QMessageBox::information(window(), QLatin1String("Notice"), QLatin1String("The program must be restarted for the language change to take effect!")); break; default: qApp->installEventFilter(this); qApp->installTranslator(&translation.getQtTranslator()); qApp->installTranslator(&translation.getAppTranslator()); QMessageBox::information(window(), tr("Notice"), tr("The program must be restarted for the language change to take effect!")); qApp->removeTranslator(&translation.getAppTranslator()); qApp->removeTranslator(&translation.getQtTranslator()); qApp->removeEventFilter(this); } setSetting(Settings::General_Language, new_language); setSetting(Settings::General_TranslationFile, translation_file); #if defined(Q_OS_MAC) // The native [file] dialogs will use the first element of the // AppleLanguages array in the application's .plist file - // and this file is also the one used by QSettings. const QString mapper_language(translation.getLocale().name().left(2)); QSettings().setValue(QLatin1String{"AppleLanguages"}, { mapper_language }); #endif } setSetting(Settings::General_OpenMRUFile, open_mru_check->isChecked()); setSetting(Settings::HomeScreen_TipsVisible, tips_visible_check->isChecked()); setSetting(Settings::General_NewOcd8Implementation, ocd_importer_check->isChecked()); setSetting(Settings::General_RetainCompatiblity, compatibility_check->isChecked()); setSetting(Settings::General_PixelsPerInch, ppi_edit->value()); auto name_latin1 = encoding_box->currentText().toLatin1(); if (name_latin1 == "System" || QTextCodec::codecForName(name_latin1)) { setSetting(Settings::General_Local8BitEncoding, name_latin1); } int interval = autosave_interval_edit->value(); if (!autosave_check->isChecked()) interval = -interval; setSetting(Settings::General_AutosaveInterval, interval); }
bool Map::load (const std::string& name) { ScopedPtr<IMapContext> ctx(getMapContext(name)); resetCurrentMap(); if (name.empty()) { info(LOG_MAP, "no map name given"); return false; } info(LOG_MAP, "load map " + name); if (!ctx->load(false)) { error(LOG_MAP, "failed to load the map " + name); return false; } ctx->save(); _settings = ctx->getSettings(); _startPositions = ctx->getStartPositions(); _name = ctx->getName(); _title = ctx->getTitle(); _width = getSetting(msn::WIDTH, "-1").toInt(); _height = getSetting(msn::HEIGHT, "-1").toInt(); _solution = getSolution(); const std::string solutionSteps = string::toString(_solution.length()); _settings.insert(std::make_pair("best", solutionSteps)); info(LOG_MAP, "Solution has " + solutionSteps + " steps"); if (_width <= 0 || _height <= 0) { error(LOG_MAP, "invalid map dimensions given"); return false; } const std::vector<MapTileDefinition>& mapTileList = ctx->getMapTileDefinitions(); for (std::vector<MapTileDefinition>::const_iterator i = mapTileList.begin(); i != mapTileList.end(); ++i) { const SpriteType& t = i->spriteDef->type; info(LOG_MAP, "sprite type: " + t.name + ", " + i->spriteDef->id); MapTile *mapTile = new MapTile(*this, i->x, i->y, getEntityTypeForSpriteType(t)); mapTile->setSpriteID(i->spriteDef->id); mapTile->setAngle(randBetweenf(-0.1, 0.1f)); loadEntity(mapTile); } info(LOG_MAP, String::format("map loading done with %i tiles", mapTileList.size())); ctx->onMapLoaded(); _frontend->onMapLoaded(); const LoadMapMessage msg(_name, _title); _serviceProvider->getNetwork().sendToAllClients(msg); _mapRunning = true; return true; }
void Settings::saveSettings(){ remove("settings.ini"); std::ofstream fileStream("settings.ini", std::ofstream::out); if (fileStream.is_open()){ fileStream << "screenWidth=" << getSetting("screenWidth") << std::endl; fileStream << "screenHeight=" << getSetting("screenHeight") << std::endl; fileStream << "fullscreen=" << getSetting("fullscreen") << std::endl; } fileStream.close(); }
void EncoderLame::saveSettings() { if(m_symbolsResolved) { RbSettings::setSubValue("lame", RbSettings::EncoderVolume, getSetting(VOLUME)->current().toDouble()); RbSettings::setSubValue("lame", RbSettings::EncoderQuality, getSetting(QUALITY)->current().toDouble()); m_encoderVolume = RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble(); m_encoderQuality = RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble(); } }
void EncRbSpeex::saveSettings() { //save settings in user config RbSettings::setSubValue("rbspeex",RbSettings::EncoderVolume, getSetting(eVOLUME)->current().toDouble()); RbSettings::setSubValue("rbspeex",RbSettings::EncoderQuality, getSetting(eQUALITY)->current().toDouble()); RbSettings::setSubValue("rbspeex",RbSettings::EncoderComplexity, getSetting(eCOMPLEXITY)->current().toInt()); RbSettings::setSubValue("rbspeex",RbSettings::EncoderNarrowBand, getSetting(eNARROWBAND)->current().toBool()); RbSettings::sync(); }
void TTSSapi::saveSettings() { //save settings in user config RbSettings::setSubValue("sapi",RbSettings::TtsLanguage, getSetting(eLANGUAGE)->current().toString()); RbSettings::setSubValue("sapi",RbSettings::TtsVoice, getSetting(eVOICE)->current().toString()); RbSettings::setSubValue("sapi",RbSettings::TtsSpeed, getSetting(eSPEED)->current().toInt()); RbSettings::setSubValue("sapi",RbSettings::TtsOptions, getSetting(eOPTIONS)->current().toString()); RbSettings::sync(); }
int CIcqProto::getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid) { DBVARIANT dbv = {DBVT_DELETED}; int iRes = 1; *pdwUin = 0; if (ppszUid) *ppszUid[0] = '\0'; if (!getSetting(hContact, UNIQUEIDSETTING, &dbv)) { if (dbv.type == DBVT_DWORD) { *pdwUin = dbv.dVal; iRes = 0; } else if (dbv.type == DBVT_ASCIIZ) { if (ppszUid && m_bAimEnabled) { strcpy(*ppszUid, dbv.pszVal); iRes = 0; } else NetLog_Server("AOL screennames not accepted"); } ICQFreeVariant(&dbv); } return iRes; }
void drawUFO(point pos, short scale){ point topL, topR, midTL, midTR, midBL, midBR, botL, botR; point myUFO[8]; topL = makePoint(pos.x-scale*2, pos.y-3*scale); topR = makePoint(pos.x+scale*2, pos.y-3*scale); midTL= makePoint(pos.x-scale*3, pos.y-1*scale); midTR= makePoint(pos.x+scale*3, pos.y-1*scale); midBL= makePoint(pos.x-scale*6, pos.y+1*scale); midBR= makePoint(pos.x+scale*6, pos.y+1*scale); botL = makePoint(pos.x-scale*4, pos.y+3*scale); botR = makePoint(pos.x+scale*4, pos.y+3*scale); myUFO[0] = topL; myUFO[1] = topR; myUFO[2] = midTR; myUFO[3] = midBR; myUFO[4] = botR; myUFO[5] = botL; myUFO[6] = midBL; myUFO[7] = midTL; if(getSetting() >= 1) { drawFilledPolygon(myUFO, 8, PLAYER_SHADE); } else { drawPolygon(myUFO, 8, PLAYER_SHADE); } drawLine(makePoint(pos.x-scale*3, pos.y-1*scale), makePoint(pos.x+scale*3, pos.y-1*scale), 0xF); drawLine(makePoint(pos.x-scale*6, pos.y+1*scale), makePoint(pos.x+scale*6, pos.y+1*scale), 0xF); }
void BufferManager::dropBuffer(Buffer* buffer) { if (_log->isDebug()) _log->debug(2, "dropBuffer(buffer: fileName %s)", buffer->fileName().c_str()); // Removes the file if the buffermanager does not have more buffers of the same file std::map<std::string, int*>::iterator it = _buffersByLog->find(buffer->fileName()); // If the file counter is zero it means there're no references to it and should be // deleted from disk (pe. commit), if the file is not referenced this will mean the // buffer comes from other buffermanager and should be removed. bool dropFile = false; if (it != _buffersByLog->end()) { int* count = it->second; if (*count <= 0) { dropFile = true; delete count; _buffersByLog->erase(it); } } else { dropFile = true; } if (dropFile) { std::string file = buffer->fileName(); std::string datadir = getSetting("DATA_DIR"); char* fullFilePath = combinePath(datadir.c_str(), file.c_str()); if (_log->isDebug()) _log->debug(2, "removing the log file: %s", fullFilePath); if (existFile(fullFilePath)) { if (!removeFile(fullFilePath)) { _log->error("An error ocurred removing the file: %s. Error Number: %d, Error description: %s", fullFilePath, errno, strerror(errno)); } } free(fullFilePath); } delete buffer; }
/*! \fn OptionsDialog::loadProfiles() */ void OptionsDialog::loadProfiles() { QStringList profiles = getSetting("profiles").toStringList(); profilesList->clear(); profilesList->addItems(profiles); setCurrentProfile(); profileSelectionChanged(); }
string LogManager::getPath(const UserPtr& aUser, ParamMap& params, bool addCache /*false*/) { if (aUser->isNMDC() || !SETTING(PM_LOG_GROUP_CID)) { return getPath(PM, params); } //is it cached? auto p = pmPaths.find(aUser->getCID()); if (p != pmPaths.end()) { //can we still use the same dir? if (Util::getFilePath(getPath(PM, params)) == Util::getFilePath(p->second)) return p->second; } //check the directory string fileName = getSetting(PM, FILE); ensureParam("%[userCID]", fileName); string path = SETTING(LOG_DIRECTORY) + Util::formatParams(fileName, params); auto files = File::findFiles(Util::getFilePath(path), "*" + aUser->getCID().toBase32() + "*", File::TYPE_FILE); if (!files.empty()) { path = files.front(); } if (addCache) pmPaths.emplace(aUser->getCID(), path); return path; }
void CAimProto::avatar_request_handler(HANDLE hContact, char* hash, unsigned char type)//checks to see if the avatar needs requested { if (hContact == NULL) { hash = hash_lg ? hash_lg : hash_sm; type = hash_lg ? 12 : 1; } char* saved_hash = getSetting(hContact, AIM_KEY_AH); if (hash && _stricmp(hash, "0201d20472") && _stricmp(hash, "2b00003341")) //gaim default icon fix- we don't want their blank icon displaying. { if (_strcmps(saved_hash, hash)) { setByte(hContact, AIM_KEY_AHT, type); setString(hContact, AIM_KEY_AH, hash); sendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } } else { if (saved_hash) { deleteSetting(hContact, AIM_KEY_AHT); deleteSetting(hContact, AIM_KEY_AH); sendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } } mir_free(saved_hash); }
void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const char* data, int data_len) { bool res = false; PROTO_AVATAR_INFORMATIONT AI = {0}; AI.cbSize = sizeof(AI); AI.hContact = contact_from_sn(sn); if (data_len > 0) { const TCHAR *type; AI.format = detect_image_type(data, type); get_avatar_filename(AI.hContact, AI.filename, SIZEOF(AI.filename), type); int fileId = _topen(AI.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); if (fileId >= 0) { _write(fileId, data, data_len); _close(fileId); res = true; char *my_sn = getSetting(AIM_KEY_SN); if (!_strcmps(sn, my_sn)) CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0); mir_free(my_sn); } // else // ShowError("Cannot set avatar. File '%s' could not be created/overwritten", file); } else LOG("AIM sent avatar of zero length for %s.(Usually caused by repeated request for the same icon)", sn); sendBroadcast(AI.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &AI, 0); }
void addUserListToSource(struct SourceList *list, const char *file) { char *filename = NULL; FILE *fd; if (file[0] == '/') { filename = sgStrdup(file); } else { const char *dbhome = getSetting("dbhome"); if (dbhome == NULL) dbhome = DEFAULT_DBHOME; asprintf(&filename, "%s/%s", dbhome, file); } if ((fd = fopen(filename, "r")) == NULL) { sgLogError("can't open userlist %s: %s", filename, strerror(errno)); return; } addUsersFromFp(list, fd); fclose(fd); }