Exemplo n.º 1
0
Arquivo: win.c Projeto: michalsc/AROS
static IPTR mDelete(struct IClass *cl, Object *obj, struct MUIP_Win_Delete *msg)
{
    struct data *data = INST_DATA(cl,obj);

    if (!delEntry(data->browserList,msg->entry))
        if (!delEntry(data->mailerList,msg->entry))
            delEntry(data->FTPList,msg->entry);

    return 0;
}
Exemplo n.º 2
0
void Cluster::addInst(DInst *dinst) {
  
  rdRegPool.add(2, dinst->getStatsFlag()); // 2 reads

#ifdef ESESC_FUZE
  if (dinst->getInst()->hasDstRegister()) {
#else
  if (dinst->getInst()->hasDstRegister()) {
#endif

    wrRegPool.inc(dinst->getStatsFlag());
    regPool--;
  }

  window.addInst(dinst);

  newEntry();
}

//************ Executing Cluster

void ExecutingCluster::executing(DInst *dinst) {

  window.wakeUpDeps(dinst);
  delEntry();
}
Exemplo n.º 3
0
void ScanThread::checkDir(const Record& recDir)
try
{
    const fs::path dirPath = recDir.second.header.fileName;
            
    if(fs::is_directory(dirPath))
    {              
        time_t const lastWriteTime = fs::last_write_time(dirPath);

        if(lastWriteTime != recDir.second.header.lastWriteTime)
        {
            RecordData newData = recDir.second;
            
            newData.header.lastWriteTime = lastWriteTime;
            replaceEntry(make_Record(recDir.first, std::move(newData)));
            
            scanDir(recDir.first, 
                    fs::directory_iterator(dirPath), 
                    fs::directory_iterator());
        }
    }
    else
    {
        delEntry(recDir.first);
    }
}
catch(const std::exception& ex)
{
	std::cerr << "Failed to check dir '" 
			<< recDir.second.header.fileName << "': " << ex.what() << std::endl;
}
Exemplo n.º 4
0
void ExecutedCluster::executed(DInst *dinst)
{
  dinst->markExecuted();

  delEntry();

  window.executed(dinst);
}
Exemplo n.º 5
0
void RetiredCluster::retire(DInst *dinst)
{
#ifdef SESC_BAAD
  dinst->setRetireTime();
#endif

#ifdef WINDOW_USE_HIST
  winHist.sample(windowSize);
#endif
  winNotUsed.sample(windowSize);
  delEntry();
}
Exemplo n.º 6
0
bool RetiredCluster::retire(DInst *dinst, bool reply) {

  bool done = dinst->getClusterResource()->retire(dinst, reply);
  if( !done )
    return false;

#ifdef ESESC_FUZE
  bool hasDest = (dinst->getInst()->hasDstRegister());
#else
  bool hasDest = (dinst->getInst()->hasDstRegister());
#endif

  if( hasDest )
    regPool++;

  winNotUsed.sample(windowSize, dinst->getStatsFlag());
  delEntry();

  return true;
}
Exemplo n.º 7
0
void ScanThread::scanDir(
            const RecordID& dirId, 
            EntriesIt itEntriesBegin, 
            EntriesIt itEntriesEnd)
{
	if (shouldBreak())
	{
		return;
	}
	
	Records oldRecords = db_.children(dirId);
	std::sort(oldRecords.begin(), oldRecords.end(), CmpByPath());
		
	auto entriesRange = boost::make_iterator_range(itEntriesBegin, itEntriesEnd);
	
	for (const auto& entry : entriesRange)
	{
		scanEntry(getPath(entry), dirId, oldRecords, isRecursive(entry));
		
		if (shouldBreak())
		{
			return;
		}
	}
	
	for (const Record& missing : oldRecords)
	{
		try
		{
            delEntry(missing.first);
		}
		catch(std::exception const& ex)
		{
			std::cerr << "Failed to delete DB record for '" 
					<< missing.second.header.fileName << "' entry: " 
					<< ex.what() << std::endl;
		}
	}
}
Exemplo n.º 8
0
void ExecutedCluster::executed(DInst *dinst) {

  window.executed(dinst);

  delEntry();
}
Exemplo n.º 9
0
void Sup::input(const QString &gid, const QString &uid, const QString &str, bool inpm, bool isAdmin)
{
    qint64 gidnum = gid.mid(5).toLongLong();

    if (nameDatabase->groups().keys().contains(gidnum))
        ++lastSup[gidnum];

    if (nameDatabase->groups().keys().contains(gidnum) && str.startsWith("!sup"))
    {
        QStringList args = str.split(' ', QString::SkipEmptyParts);

        QString message;
        int perm = 0;

        if (args.size() > 2 && (args[1].toLower().startsWith("del") || args[1].toLower().startsWith("rem")))
        {
            perm = permission->getPermission(gidnum, "sup", "delete", isAdmin, inpm);
            if (perm == 1)
            {
                int start, end;
                int idx = args[2].indexOf('-');
                bool ok1, ok2;

                if (idx == -1)
                {
                    start = end = args[2].toInt(&ok1);
                    ok2 = true;
                }
                else
                {
                    start = args[2].mid(0, idx).toInt(&ok1);
                    end = args[2].mid(idx + 1).toInt(&ok2);
                }

                if (ok1 && ok2 && start > 0 && end > 0 && end >= start && end <= data[gidnum].size())
                {
                    qDebug() << "Deleting: " << start << ' ' << end;
                    for (int i = start; i <= end; ++i)
                        delEntry(gidnum, start);
                    message = "Deleted 'sup entry(ies)!";
                }
            }
        }
        else if (args.size() > 2 && args[1].toLower().startsWith("add"))
        {
            perm = permission->getPermission(gidnum, "sup", "add", isAdmin, inpm);
            if (perm == 1)
            {
                int idx = str.indexOf("add", 0, Qt::CaseInsensitive);
                int seenSpace = 0;
                while (idx < str.length())
                {
                    if (str[idx] == ' ')
                        seenSpace = 1;
                    else if (seenSpace == 1)
                    {
                        seenSpace = 2;
                        break;
                    }

                    ++idx;
                }

                if (seenSpace == 2)
                {
                    if (addEntry(gidnum, str.mid(idx)))
                    {
                        qDebug() << "Here adding sup...!";
                        message = "Added 'sup entry!";
                        freshSup();

                        QString subscribeMessage = QString("New 'Sup Entry: %1").arg(str.mid(idx));
                        subscribe->postToSubscribed(gidnum, subscribeMessage);
                    }
                    else
                        message = "Couldn't add new 'sup entry; Maybe delete some entries first.";
                }
            }
        }
        else if (args.size() > 3 && args[1].toLower().startsWith("edit"))
        {
            perm = permission->getPermission(gidnum, "sup", "edit", isAdmin, inpm);
            if (perm == 1)
            {
                bool ok;
                int id = args[2].toInt(&ok);

                if (ok && id > 0 && id <= data[gidnum].size())
                {
                    int idx = str.indexOf("edit", 0, Qt::CaseInsensitive);
                    while (str[idx] != ' ')
                        ++idx;
                    while (str[idx] == ' ')
                        ++idx;
                    while (str[idx] != ' ')
                        ++idx;
                    while (str[idx] == ' ')
                        ++idx;

                    editEntry(gidnum, id, str.mid(idx));

                    message = "Edited 'sup entry!";
                }
            }
        }
        else
        {
            inpm = inpm || (args.size() > 1 && args[1].toLower().startsWith("pm"));

            perm = permission->getPermission(gidnum, "sup", "view", isAdmin, inpm);
            if (perm == 1)
            {
                if (data[gidnum].isEmpty())
                    message = "Nothing important!";
                else
                {
                    if (!inpm && lastSup[gidnum] < DistanceBetweenSup)
                        message = "Public 'sup have been already shown recently. Please scroll up or use \"!sup pm\".";
                    else
                    {
                        for (int i = 0; i < data[gidnum].size(); ++i)
                        {
                            message += QString("%1- %2").arg(i + 1).arg(data[gidnum][i].text());
                            if (i != data[gidnum].size() - 1)
                                message += "\n";
                        }

                        if (!inpm)
                        {
                            lastSup[gidnum] = 0;
                            message += QString("\n\n") + Smiley::pokerFace;
                        }
                    }
                }
            }
        }

        qDebug() << "sup module send message: " << (inpm ? uid : gid) << message;
        messageProcessor->sendMessage(inpm ? uid : gid, message);

        if (perm == 2)
            permission->sendRequest(gid, uid, str, inpm);
    }
}
Exemplo n.º 10
0
void RetiredCluster::retire(DInst *dinst)
{
  winNotUsed.sample(windowSize);

  delEntry();
}