Esempio n. 1
0
LogEntry fromBibtexMatch(const boost::smatch& match,
                         const FilePath& compileDir)
{
   return LogEntry(LogEntry::Error,
                   texFilePath(match[3], compileDir),
                   boost::lexical_cast<int>(match[2]),
                   match[1]);
}
Esempio n. 2
0
Log::LogEntry DefaultLog::getNextEntry()
{
	QMutexLocker locker(&logAccess);

	if ( loggedEvents.size() == loggedEntriesSeen ) return LogEntry();

	loggedEntriesSeen++;
	return loggedEvents[loggedEntriesSeen - 1];
}
Esempio n. 3
0
bool SettingsSetActiveByName(const char* Setting) {
    uint8_t SettingNr = Setting[0] - '0';

    if (Setting[1] == '\0') {
        LogEntry(LOG_INFO_SETTING_SET, Setting, 1);
        return SettingsSetActiveById(SettingNr);
    } else {
        return false;
    }
}
Esempio n. 4
0
void RobotController::UserInit()
{
	//"Initialize Robot controller"
	readConfiguration();
	gm.connectTo(conf.port(), conf.team_number());
	gm.setNonBlock(true);
	_blk.updateSubscription("buttonevents", Messaging::MessageEntry::SUBSCRIBE_ON_TOPIC);
	_blk.publishState(gm_state, "worldstate");
	LogEntry(LogLevel::Info,GetName()) << "Robot Controller Initialized" << std::endl;
	lastalive = KSystem::Time::SystemTime::now();
}
Esempio n. 5
0
void CLogDlg::WriteToLog(int warningLevel, int object, LPCTSTR strToWrite)
{
	CTime currentTime = CTime::GetCurrentTime();
	logEntry.push_back(LogEntry(currentTime.Format("%m/%d %H:%M:%S").GetString(),warningLevel,object, string(strToWrite)));
	if(logEntry.size() > MAX_LOG_SIZE)
	{
		logEntry.erase(&logEntry.front()); //pop the front if the log gets too big
		if(m_richLog.GetTextLength() > 1024*1024) // if text box gets too big
		{
			RefreshLog();
			return;
		}
	}
	WriteEntry((int)logEntry.size() - 1);
}
Esempio n. 6
0
	void Logger::Log(Severity severity
					, Facility facility
					, unsigned line
					, const std::string& file
					, const std::string& data)
	{
		if (m_MinimalLogSeverity > int(severity))
			return;

		SYSTEMTIME time;
		::GetSystemTime(&time);

		m_Buffer->AddEntry(LogEntry(severity
									, facility
									, time
									, line
									, file
									, data));
	}
Esempio n. 7
0
void DefaultLog::add(Level l, QString message)
{
	QMutexLocker locker(&logAccess);

	QTextStream out(stdout);
	QTextStream err(stderr);

	if (l == LOGERROR) err<<	"ERROR   " << pluginId << ": " << message << endl;
	if (l == LOGDEBUG) out<<	"DEBUG   " << pluginId << ": " << message << endl;
	if (l == LOGINFO) out<<		"INFO    " << pluginId << ": " << message << endl;
	if (l == LOGWARNING) out<<	"WARNING " << pluginId << ": " << message << endl;

	loggedEvents.append(LogEntry());
	loggedEvents.last().level = l;
	loggedEvents.last().message = message;
	loggedEvents.last().pluginId = pluginId;

	emit newLogEntry();
}
Esempio n. 8
0
void Worker::readEntry()
{
	if (mStream.atEnd()) {
		PRINT("Done.\n");
		return;
	}

	++mCurrentLine;
	mCurrentEntry = LogEntry(mStream.readLine());
	if (mCurrentEntry.timestamp() < mLastTimestamp) {
		PRINT(QString("Timestamp on the line %1 is invalid. Terminating.\n").arg(QString(mCurrentLine)));
		return;
	}

	qint64 const lastTimestamp =  mLastTimestamp
			? mLastTimestamp
			: mCurrentEntry.timestamp() - timeToWaitForLoaded;
	qint64 const toWait = speedUp(mCurrentEntry.timestamp() - lastTimestamp);
	mLastTimestamp = mCurrentEntry.timestamp();
	QTimer::singleShot(toWait, this, SLOT(invokeEntry()));
}
Esempio n. 9
0
bool RobotController::readConfiguration()
{
	conf.Clear(); //Initialize with default values in .proto
	gm_state.Clear(); //Initialize with default values in .proto
	gm_state.set_player_number(conf.player_number());

	int value = atoi(Configurator::Instance().findValueForKey("teamConfig.player").c_str());
	conf.set_player_number(value);
	gm_state.set_player_number(value);

	gm_state.set_team_number(conf.team_number());

	value = atoi(Configurator::Instance().findValueForKey("teamConfig.team_number").c_str());
	conf.set_team_number(value);
	gm_state.set_team_number(value);

	//If color is changed default configuration color does need to be changed
	std::string color = "blue";
	gm_state.set_team_color(conf.team_color());

	color = Configurator::Instance().findValueForKey("teamConfig.default_team_color");
	if (color.compare("blue") == 0)
	{
		conf.set_team_color(TEAM_BLUE);
		gm_state.set_team_color(TEAM_BLUE);
	}
	else if (color.compare("red") == 0)
	{
		conf.set_team_color(TEAM_RED);
		gm_state.set_team_color(TEAM_RED);
	}
	else
		LogEntry(LogLevel::Error,GetName()) << "undefined color in configuration, setting to default value: "
													<<+gm_state.team_color() << std::endl;

	return true;
}
Esempio n. 10
0
  static svn_error_t *
  logReceiver(void *baton,
              apr_hash_t * changedPaths,
              svn_revnum_t rev,
              const char *author,
              const char *date,
              const char *msg,
              apr_pool_t * pool)
  {
    LogEntries * entries = (LogEntries *) baton;
    entries->insert(entries->begin(), LogEntry(rev, author, date, msg));

    if (changedPaths != NULL)
    {
      LogEntry &entry = entries->front();

      for (apr_hash_index_t *hi = apr_hash_first(pool, changedPaths);
           hi != NULL;
           hi = apr_hash_next(hi))
      {
        char *path;
        void *val;
        apr_hash_this(hi, (const void **)&path, NULL, &val);

        svn_log_changed_path_t *log_item = reinterpret_cast<svn_log_changed_path_t *>(val);

        entry.changedPaths.push_back(
          LogChangePathEntry(path,
                             log_item->action,
                             log_item->copyfrom_path,
                             log_item->copyfrom_rev));
      }
    }

    return NULL;
  }
Esempio n. 11
0
void MockLogHandler::Log(const std::string& location, const std::string& message)
{
    this->impl->Log(LogEntry("test", openpal::logflags::EVENT, location.c_str(), message.c_str()));
}
Esempio n. 12
0
Error parseLatexLog(const FilePath& logFilePath, LogEntries* pLogEntries)
{
   static boost::regex regexOverUnderfullLines(" at lines (\\d+)--(\\d+)\\s*(?:\\[])?$");
   static boost::regex regexWarning("^(?:.*?) Warning: (.+)");
   static boost::regex regexWarningEnd(" input line (\\d+)\\.$");
   static boost::regex regexLnn("^l\\.(\\d+)\\s");
   static boost::regex regexCStyleError("^(.+):(\\d+):\\s(.+)$");

   std::vector<std::string> lines;
   Error error = readStringVectorFromFile(logFilePath, &lines, false);
   if (error)
      return error;

   std::vector<size_t> linesUnwrapped;
   unwrapLines(&lines, &linesUnwrapped);

   FilePath rootDir = logFilePath.parent();
   FileStack fileStack(rootDir);

   for (std::vector<std::string>::const_iterator it = lines.begin();
        it != lines.end();
        it++)
   {
      const std::string& line = *it;
      int logLineNum = (it - lines.begin()) + 1;

      // We slurp overfull/underfull messages with no further processing
      // (i.e. not manipulating the file stack)

      if (beginsWith(line, "Overfull ", "Underfull "))
      {
         std::string msg = line;
         int lineNum = -1;

         // Parse lines, if present
         boost::smatch overUnderfullLinesMatch;
         if (boost::regex_search(line,
                                 overUnderfullLinesMatch,
                                 regexOverUnderfullLines))
         {
            lineNum = safe_convert::stringTo<int>(overUnderfullLinesMatch[1],
                                                  -1);
         }

         // Single line case
         bool singleLine = boost::algorithm::ends_with(line, "[]");

         if (singleLine)
         {
            msg.erase(line.size()-2, 2);
            boost::algorithm::trim_right(msg);
         }

         pLogEntries->push_back(LogEntry(logFilePath,
                                         calculateWrappedLine(linesUnwrapped,
                                                              logLineNum),
                                         LogEntry::Box,
                                         fileStack.currentFile(),
                                         lineNum,
                                         msg));

         if (singleLine)
            continue;

         for (; it != lines.end(); it++)
         {
            // For multi-line case, we're looking for " []" on a line by itself
            if (*it == " []")
               break;
         }

         // The iterator would be incremented by the outer for loop, must not
         // let it go past the end! (If we did get to the end, it would
         // mean the log file was malformed, but we still can't crash in this
         // situation.)
         if (it == lines.end())
            break;
         else
            continue;
      }

      fileStack.processLine(line);

      // Now see if it's an error or warning

      if (beginsWith(line, "! "))
      {
         std::string errorMsg = line.substr(2);
         int lineNum = -1;

         boost::smatch match;
         for (it++; it != lines.end(); it++)
         {
            if (boost::regex_search(*it, match, regexLnn))
            {
               lineNum = safe_convert::stringTo<int>(match[1], -1);
               break;
            }
         }

         pLogEntries->push_back(LogEntry(logFilePath,
                                         calculateWrappedLine(linesUnwrapped,
                                                              logLineNum),
                                         LogEntry::Error,
                                         fileStack.currentFile(),
                                         lineNum,
                                         errorMsg));

         // The iterator would be incremented by the outer for loop, must not
         // let it go past the end! (If we did get to the end, it would
         // mean the log file was malformed, but we still can't crash in this
         // situation.)
         if (it == lines.end())
            break;
         else
            continue;
      }

      boost::smatch warningMatch;
      if (boost::regex_search(line, warningMatch, regexWarning))
      {
         std::string warningMsg = warningMatch[1];
         int lineNum = -1;
         while (true)
         {
            if (boost::algorithm::ends_with(warningMsg, "."))
            {
               boost::smatch warningEndMatch;
               if (boost::regex_search(*it, warningEndMatch, regexWarningEnd))
               {
                  lineNum = safe_convert::stringTo<int>(warningEndMatch[1], -1);
               }
               break;
            }

            if (++it == lines.end())
               break;
            warningMsg.append(*it);
         }

         pLogEntries->push_back(LogEntry(logFilePath,
                                         calculateWrappedLine(linesUnwrapped,
                                                              logLineNum),
                                         LogEntry::Warning,
                                         fileStack.currentFile(),
                                         lineNum,
                                         warningMsg));

         // The iterator would be incremented by the outer for loop, must not
         // let it go past the end! (If we did get to the end, it would
         // mean the log file was malformed, but we still can't crash in this
         // situation.)
         if (it == lines.end())
            break;
         else
            continue;
      }

      boost::smatch cStyleErrorMatch;
      if (boost::regex_search(line, cStyleErrorMatch, regexCStyleError))
      {
         FilePath cstyleFile = resolveFilename(rootDir, cStyleErrorMatch[1]);
         if (cstyleFile.exists())
         {
            int lineNum = safe_convert::stringTo<int>(cStyleErrorMatch[2], -1);
            pLogEntries->push_back(LogEntry(logFilePath,
                                            calculateWrappedLine(linesUnwrapped,
                                                                 logLineNum),
                                            LogEntry::Error,
                                            cstyleFile,
                                            lineNum,
                                            cStyleErrorMatch[3]));
         }
      }
   }

   return Success();
}
Esempio n. 13
0
	inline LogEntry Log(LogLevel level = LogLevelInformation) {
		return LogEntry(level);
	}
Esempio n. 14
0
	inline LogEntry Debug() {
		return LogEntry(LogLevelDebug);
	}
Esempio n. 15
0
	void Log::logMsg(const String& message, UINT32 channel)
	{
		RecursiveLock lock(mMutex);

		mUnreadEntries.push(LogEntry(message, channel));
	}
Esempio n. 16
0
LogEntry Logbook::operator()() {
  return LogEntry(this, severity);
}
Esempio n. 17
0
void Session::addLogEntry(int bgr, int bgg, int bgb, int fgr, int fgg, int fgb, const QString &text)
{
    s_log << LogEntry(bgr, bgg, bgb, fgr, fgg, fgb, text);
}
Esempio n. 18
0
/**
 * Writes an error entry to the program's log, and a stream that can be
 * used to append additional information to the entry
 *
 * \param  system  The name of the system or component writing the entry
 * \return A LogEntry object that can be used to append additional
 *         information to the log entry
 */
LogEntry Log::error( const std::string& system ) const
{
    mDebugStream->startLogEntry( system, ELOGLEVEL_ERROR );
    return LogEntry( mDebugStream );
}
Esempio n. 19
0
/**
 * Writes a warning entry to the program's log, and a stream that can be
 * used to append additional information to the entry
 *
 * \param  system  The name of the system or component writing the entry
 * \return A LogEntry object that can be used to append additional
 *         information to the log entry
 */
LogEntry Log::warn( const std::string& system ) const
{
    mDebugStream->startLogEntry( system, ELOGLEVEL_WARN );
    return LogEntry( mDebugStream );
}
Esempio n. 20
0
void CommandLine::addToLog(const std::string &functionName, const std::string &logString){
	CommandLine::log.push_back(LogEntry(functionName,logString));
};
Esempio n. 21
0
int RobotController::Execute()
{
	static int delay;
	bool changed = false;
	bool received = gm.poll();
	KSystem::Time::TimeAbsolute now = KSystem::Time::SystemTime::now();

	if(lastalive < now && received && gm_state.override_state() == OVERRIDE_DISABLED)
	{
		gm.SendAlive(conf.player_number() );
		lastalive = now + KSystem::Time::TimeAbsolute::milliseconds(ALIVEMS);
	}

	//Check if the msg changes from the outer world
	gsm = _blk.readState<GameStateMessage> ("worldstate");
	if(gsm != 0){
		gm_state.CopyFrom(*gsm);
	}

	if (received && gm_state.override_state() == OVERRIDE_DISABLED)
	{
		//teams[0] one team
		//teams[1] other team
		int teamindx = game_data.teams[0].teamNumber == conf.team_number() ? 0 : 1;
		new_gm_state.set_player_number(conf.player_number());
		new_gm_state.set_team_number(conf.team_number());
		new_gm_state.set_team_color(game_data.teams[teamindx].teamColour);
		new_gm_state.set_own_goal_color(game_data.teams[teamindx].goalColour);
		new_gm_state.set_game_state(game_data.state);
		new_gm_state.set_sec_game_state(game_data.secondaryState);
		new_gm_state.set_our_score(game_data.teams[teamindx].score);
		new_gm_state.set_otherteam_score(game_data.teams[teamindx == 1 ? 0 : 1].score);
		new_gm_state.set_firsthalf(game_data.firstHalf == 1);
		new_gm_state.set_kickoff(game_data.kickOffTeam == new_gm_state.team_color());
		new_gm_state.set_penalty(game_data.teams[teamindx].players[conf.player_number() - 1].penalty);
		new_gm_state.set_previous_player_state(gm_state.player_state());
		new_gm_state.set_secs_remaining(game_data.secsRemaining);

		// Depreciated PLAYER_PENALISED State does not exist any more!
		new_gm_state.set_player_state((game_data.teams[teamindx].players[conf.player_number() - 1].penalty == 0) ? game_data.state : PLAYER_PENALISED);

		//Check if changed
		if (gm_state.game_state() != new_gm_state.game_state() || gm_state.team_color() != new_gm_state.team_color() || gm_state.own_goal_color() != new_gm_state.own_goal_color()
		        || gm_state.penalty() != new_gm_state.penalty() || gm_state.player_state() != new_gm_state.player_state()
		        || gm_state.sec_game_state() != new_gm_state.sec_game_state() || gm_state.our_score() != new_gm_state.our_score() || gm_state.otherteam_score()
		        != new_gm_state.otherteam_score() || gm_state.firsthalf() != new_gm_state.firsthalf() || gm_state.kickoff() != new_gm_state.kickoff()
		        || gm_state.secs_remaining() != new_gm_state.secs_remaining())
		{
			changed = true;
			gm_state.CopyFrom(new_gm_state);
		}
	}

	boost::shared_ptr<const ButtonMessage> bm = _blk.readSignal<ButtonMessage>("buttonevents");

	if(bm.get() != NULL)
	{
		int lbump = bm->data(KDeviceLists::L_BUMPER_L) + bm->data(KDeviceLists::L_BUMPER_R);
		int rbump = bm->data(KDeviceLists::R_BUMPER_L) + bm->data(KDeviceLists::R_BUMPER_R);
		int chest = bm->data(KDeviceLists::CHEST_BUTTON);

		if(chest == 4 || ((lbump + rbump) > 0 && chest == 2))
		{
			LogEntry(LogLevel::Info,GetName()) << "Shutdown robot" << std::endl;
			gm_state.Clear();
			gm_state.set_player_number(conf.player_number());
			gm_state.set_team_number(conf.team_number());
			gm_state.set_team_color(conf.team_color());
			gm_state.set_override_state(OVERRIDE_DROPDEAD);
			SysCall::_Shutdown();
			changed = true;
		}
		else if(chest == 2) //DOUBLE CHEST CLICK
		{
			gm_state.Clear();
			gm_state.set_player_number(conf.player_number());
			gm_state.set_team_number(conf.team_number());
			gm_state.set_team_color(conf.team_color());

			if(gm_state.override_state() != OVERRIDE_DROPDEAD)
				gm_state.set_override_state(OVERRIDE_DROPDEAD);
			else
				gm_state.set_override_state(OVERRIDE_DISABLED);

			changed = true;
		}
		else if((lbump + rbump) > 0 && chest == 1)
		{
			if(gm_state.override_state() == OVERRIDE_DISABLED)
			{
				gm_state.Clear();
				gm_state.set_player_number(conf.player_number());
				gm_state.set_team_number(conf.team_number());
				gm_state.set_team_color(conf.team_color());
				gm_state.set_override_state(OVERRIDE_ENABLED);
			}
			else
				gm_state.set_override_state(OVERRIDE_DISABLED);

			changed = true;
		}
		else if(rbump > 0 && gm_state.player_state() != PLAYER_PLAYING && gm_state.override_state() != OVERRIDE_DROPDEAD)
		{
			gm_state.set_kickoff((gm_state.kickoff() + 1) % 2);
			changed = true;
		}
		else if(lbump > 0 && gm_state.player_state() != PLAYER_PLAYING && gm_state.override_state() != OVERRIDE_DROPDEAD)
		{
			gm_state.set_team_color((gm_state.team_color() + 1) % 2);
			changed = true;
		}
		else if(chest == 1 && !(received && gm_state.override_state() == OVERRIDE_DISABLED) )
		{
			switch (gm_state.player_state())
			{
			case PLAYER_INITIAL:
				gm_state.set_penalty(PENALTY_MANUAL);
				gm_state.set_game_state(STATE_PLAYING);
				gm_state.set_player_state(PLAYER_PENALISED);
				gm_state.set_previous_player_state(PLAYER_INITIAL);
				break;

			case PLAYER_PLAYING:
				gm_state.set_penalty(PENALTY_MANUAL);
				gm_state.set_game_state(STATE_PLAYING);
				gm_state.set_player_state(PLAYER_PENALISED);
				gm_state.set_previous_player_state(PLAYER_PLAYING);
				break;

			case PLAYER_PENALISED:
				gm_state.set_game_state(STATE_PLAYING);
				gm_state.set_penalty(PENALTY_NONE);
				gm_state.set_player_state(PLAYER_PLAYING);
				gm_state.set_previous_player_state(PLAYER_PENALISED);
				break;

			default:
				gm_state.set_game_state(STATE_PLAYING);
				gm_state.set_penalty(PENALTY_NONE);
				gm_state.set_player_state(PLAYER_PLAYING);
				gm_state.set_previous_player_state(PLAYER_INITIAL);
			}

			changed = true;
		}
	}

	if (changed)
	{
		sendLedUpdate();
		_blk.publishState(gm_state, "worldstate");
	}
	else if (delay++ % 50 == 0)
	{
		sendLedUpdate();
	}

	return 0;
}
Esempio n. 22
0
LogEntry Logbook::operator()(const Severity& severity) {
  return LogEntry(this, severity);
}
Esempio n. 23
0
/**
 * Writes an info entry to the program's log, and a stream that can be
 * used to append additional information to the entry
 *
 * \param  system  The name of the system or component writing the entry
 * \return A LogEntry object that can be used to append additional
 *         information to the log entry
 */
LogEntry Log::info( const std::string& system ) const
{
    mDebugStream->startLogEntry( system, ELOGLEVEL_INFO );
    return LogEntry( mDebugStream );
}
Esempio n. 24
0
File: menu.c Progetto: ftnapps/FTNd
void DoMenu(int Type)
{
    int	    Strlen, i, x;
    char    *sPrompt, *sPromptBak, *temp;

    sPrompt    = calloc(81, sizeof(char));
    sPromptBak = calloc(81, sizeof(char));
    temp       = calloc(81, sizeof(char));

    TimeCheck();

    switch(Type) {
	case 0: /* Display Prompt Line Only */
		break;

	case 1:
		/* Goto another menu */
		strncpy(Menus[MenuLevel], menus.OptionalData, 14);
		break;

	case 2:
		/* Gosub another menu */
		if (MenuLevel < 49) {
		    MenuLevel++;
		    strncpy(Menus[MenuLevel], menus.OptionalData, 14);
		} else
		    Syslog('?', "More than 50 menu levels");
		break;

	case 3:
		/* Return from gosub */
		if (MenuLevel > 0) 
		    MenuLevel--;
		break;

	case 4:
		/* Return to top menu */
		MenuLevel = 0;
		break;

	case 5:
		/* Display .a?? file with controlcodes */
		DisplayFile(menus.OptionalData);
		break;

	case 6:
		/* Show menu prompt */
		Strlen = strlen(menus.OptionalData);
		for (x = 0; x < Strlen; x++) {
		    if (menus.OptionalData[x] == '~') {
			strcat(sPrompt, sUserTimeleft);
		    } else {
			snprintf(temp, 81, "%c", menus.OptionalData[x]);
			strcat(sPrompt, temp);
		    }
		}
		strcpy(sPromptBak, sPrompt);
		strcpy(sPrompt, "");
		Strlen = strlen(sPromptBak);
		for (x = 0; x < Strlen; x++) {
		    if (*(sPromptBak + x) == '@')
			strcat(sPrompt, sAreaDesc);
		    else if (*(sPromptBak + x) == '^')
			strcat(sPrompt, sMsgAreaDesc);
		    else if (*(sPromptBak + x) == '#')
			snprintf(sPrompt, 81, "%s%s", sPrompt, (char *) GetLocalHM()); 
		    else {
			snprintf(temp, 81, "%c", *(sPromptBak + x));
			strcat(sPrompt, temp);
		    }
		}
		if (le_int(menus.ForeGnd) || le_int(menus.BackGnd))
		    pout(le_int(menus.ForeGnd), le_int(menus.BackGnd), sPrompt);
		else
		    pout(WHITE, BLACK, sPrompt);
		break;

	case 7:
		/* Run external program */
		if (strlen(menus.DoorName) && !menus.HideDoor) {
		    memset(temp, 0, sizeof(temp));
		    strcpy(temp, menus.DoorName);
		    ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, 
			menus.NoSuid, menus.NoPrompt, menus.SingleUser, temp);
		} else {
		    ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport,
			menus.NoSuid, menus.NoPrompt, menus.SingleUser, NULL);
		}
		break;

	case 8:
		/* Show product information */
		cr();
		break;

	case 9:
		/* display todays callers */
		LastCallers(menus.OptionalData);
		break;

	case 10:
		/* display userlist */
		UserList(menus.OptionalData);
		break;

	case 11:
		/* display time statistics */
		TimeStats();
		break;

	case 12:
		/* page sysop for chat */
		Page_Sysop(menus.OptionalData);
		break;

	case 13:
		/* terminate call */
		free(sPrompt);
		free(sPromptBak);
		free(temp);
		Good_Bye(FTNERR_OK);
		break;

	case 14:
		/* make a log entry */
		LogEntry(menus.OptionalData);
		break;

	case 15:
		/* print text to screen */
		if (exitinfo.Security.level >= le_int(menus.MenuSecurity.level)) {
		    for (i = 0; i < strlen(menus.OptionalData); i++)
			if (*(menus.OptionalData + i) == '@')
			    *(menus.OptionalData + i) = '\n';
		    snprintf(temp, 81, "%s\r\n", menus.OptionalData);
		    PUTSTR(temp);
		}
		break;

	case 16:
		/* who's currently online */
		WhosOn(menus.OptionalData);
		Pause();
		break;

	case 17:
		/* comment to sysop */
		SysopComment((char *)"Comment to Sysop");
		break;

	case 18:
		/* send on-line message */
		SendOnlineMsg(menus.OptionalData);
		break;
		
	case 19:
		/* display Textfile with more */
		MoreFile(menus.OptionalData);
		break;

	case 20:
		/* display a?? file with controlcode and wait for enter */
		DisplayFileEnter(menus.OptionalData);
 		break;

	case 21:
		/* display menuline only */
		break;

	case 22:
		/* Chat with any user */
		Chat(NULL, NULL);
		break;

	case 101:
		FileArea_List(menus.OptionalData);
		break;

	case 102:
		File_List();
		break;

	case 103:
		ViewFile(NULL);
		break;

	case 104:
		Download();
		break;

	case 105:
		File_RawDir(menus.OptionalData);
		break;

	case 106:
		KeywordScan();
		break;

	case 107:
		FilenameScan();
		break;

	case 108:
		NewfileScan(TRUE);
		break;

	case 109:
		Upload();
		break;

	case 110:
		EditTaglist();
		break;

	case 111: /* View file in homedir */
		break;

	case 112:
		DownloadDirect(menus.OptionalData, TRUE);
		break;

	case 113:
		Copy_Home();
		break;

	case 114:
		List_Home();
		break;

	case 115:
		Delete_Home();
		break;

	/* 116 Unpack file in homedir */

	/* 117 Pack files in homedir */

	case 118:
		Download_Home();
		break;

	case 119:
		Upload_Home();
		break;

	case 201:
		MsgArea_List(menus.OptionalData);
		break;

	case 202:
		Post_Msg(); 
		break;

	case 203:
		Read_Msgs();
		break;

	case 204:
		CheckMail();
		break;

	case 205:
		QuickScan_Msgs();
		break;

	case 206:
		Delete_Msg();
		break;

	case 207:
		MailStatus();
		break;

	case 208:
		OLR_TagArea();
		break;

	case 209:
		OLR_UntagArea();
		break;

	case 210:
		OLR_ViewTags();
		break;

	case 211:
		OLR_RestrictDate();
		break;

	case 212:
		OLR_Upload();
		break;

	case 213:
		OLR_DownBW();
		break;

	case 214:
		OLR_DownQWK();
		break;

	case 215:
		OLR_DownASCII();
		break;

	case 216:
		Read_Email();
		break;

	case 217:
		Write_Email();
		break;

	case 218:
		Trash_Email();
		break;

	case 219:
		Choose_Mailbox(menus.OptionalData);
		break;

	case 220:
		QuickScan_Email();
		break;

	case 221:
		DisplayRules();
		break;

	case 301:
		Chg_Protocol();
		break;

	case 302:
		Chg_Password();
		break;

	case 303:
		Chg_Location();
		break;

	case 305:
		Chg_VoicePhone();
		break;

	case 306:
		Chg_DataPhone();
		break;

	case 307:
		Chg_News();
		break;

	case 309:
		Chg_DOB();
		break;

	case 310:
		Chg_Language(FALSE);
		break;

	case 311:
		Chg_Hotkeys();
		break;

	case 312:
		Chg_Handle();
		break;

	case 313:
		Chg_MailCheck();
		break;

	case 314:
		Chg_Disturb();
		break;

	case 315:
		Chg_FileCheck();
		break;

	case 316:
		Chg_FsMsged();
		break;

	case 317:
		Chg_FsMsgedKeys();
		break;

	case 318:
		Chg_Address();
		break;

	case 319:
		signature();
		break;

	case 320:
		Chg_OLR_ExtInfo();
		break;

	case 321:
		Chg_Charset();
		break;

	case 322:
		Chg_Archiver();
		break;

	case 401:
		Oneliner_Add();
		break;

	case 402:
		Oneliner_List();
		break;

	case 403:
		Oneliner_Show();
		break;

	case 404:
		Oneliner_Delete();
		break;

	case 405:
		Oneliner_Print();
		break;

	default:
		Enter(1);
		pout(WHITE, BLACK, (char *) Language(339));
		Enter(2);
		Syslog('?', "Option: %s -> Unknown Menu Type: %d on %s", menus.MenuKey, Type, Menus[MenuLevel]); 
		Pause();
	}

	free(sPrompt);
	free(sPromptBak);
	free(temp);
}
Esempio n. 25
0
/**
 * Writes a notice entry to the program's log, and a stream that can be
 * used to append additional information to the entry
 *
 * \param  system  The name of the system or component writing the entry
 * \return A LogEntry object that can be used to append additional
 *         information to the log entry
 */
LogEntry Log::notice( const std::string& system ) const
{
    mDebugStream->startLogEntry( system, ELOGLEVEL_NOTICE );
    return LogEntry( mDebugStream );
}
Esempio n. 26
0
/**
 * Writes a debug entry to the program's log, and a stream that can be
 * used to append additional information to the entry
 *
 * \param  system  The name of the system or component writing the entry
 * \return A LogEntry object that can be used to append additional
 *         information to the log entry
 */
LogEntry Log::debug( const std::string& system ) const
{
    mDebugStream->startLogEntry( system, ELOGLEVEL_DEBUG );
    return LogEntry( mDebugStream );
}
Esempio n. 27
0
Talws::Talws ()
{
	LoggerSingleton::Instance();
	com.StartThread();

	std::string agentFile = Configurator::Instance().findValueForKey("monasConfig.AgentConfigurationFile");
	if ( Configurator::Instance().numberOfNodesForKey(agentFile) != 1)
	{
		{ //Create different scope to ensure that m gets destructed and dispatched
			LogEntry m(LogLevel::FatalError,"Talws");
			m<<"Can't read or parse agent configuration file @ "
			 << Configurator::Instance().getDirectoryPath()
			 << Configurator::Instance().findValueForKey("monasConfig.AgentConfigurationFile");
		}
		SysCall::_exit(1);
	}

	//======================= Start Agents  ===================================
	int numOfAgents = Configurator::Instance().numberOfNodesForKey(agentFile + ".agent");
	LogEntry(LogLevel::Info,"Talws")<<"Found "<< (numOfAgents) <<" agent(s)";
	for (int i=0;i<numOfAgents;i++)
	{
		if(atoi(Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i)+".$Enable").c_str()) == 1){
			std::string AgentName = Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i) + ".name");
			//Clear naming conflicts



            for(unsigned k=0;k<Agents.size();k++)
            {
                if(AgentName.compare(Agents[k]->GetName())==0)
                {
                    LogEntry(LogLevel::Warning,"Talws")  << "Agent name: " << AgentName << " exists! mangling name to resolve conflict";
                    AgentName+="_mangling";
                    k=0;
                }
            }
			int numOfActivities = Configurator::Instance().numberOfNodesForKey(agentFile + ".agent~" + _toString(i) + ".activity");
			std::vector<std::string> activities;

			for (int j = 0; j < numOfActivities; j++ )
			{
				if(atoi(Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i) + ".activity~" + _toString(j) + ".$Enable").c_str()) == 1){
					activities.push_back( Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i) + ".activity~" + _toString(j)) );
					LogEntry(LogLevel::ExtraInfo,"Talws")<<"Agent: " << AgentName << " Registering module: " + activities.back();
				}
			}

			KSystem::ThreadConfig tcfg;
			tcfg.IsRealTime = atoi(Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i)+".$IsRealTime").c_str()) == 0 ? false : true;
			tcfg.Priority = atoi(Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i)+".$Priority").c_str());
			float threadFreq = atof(Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i)+".$ThreadFrequency").c_str());
			tcfg.ThreadPeriod = threadFreq > 0 ? 1 / threadFreq  : 0;
			int StatsCycle = atoi(Configurator::Instance().findValueForKey(agentFile + ".agent~" + _toString(i)+".$StatsCycle").c_str());
			Agent *a = new Agent(AgentName, tcfg, StatsCycle, com, activities);
			Agents.push_back( a );

			LogEntry m(LogLevel::ExtraInfo,"Talws");
			m		  << AgentName
				      << " Attrb: IsRealTime=" << tcfg.IsRealTime
				      << " Priority=" << tcfg.Priority
				      << " ThreadFrequency=" << tcfg.ThreadPeriod
				      << " StatsCycle=" << StatsCycle ;
		}
	}
	//======================= Start StateCharts  ===================================
	int numOfStatecharts = Configurator::Instance().numberOfNodesForKey(agentFile + ".statechart");
	LogEntry(LogLevel::Info,"Talws") << "Found " <<(numOfStatecharts) + " statechart plan(s)";

	for (int i=0;i<numOfStatecharts;i++){
		if(atoi(Configurator::Instance().findValueForKey(agentFile + ".statechart~" + _toString(i)+".$Enable").c_str()) == 1){
			std::string statechart = Configurator::Instance().findValueForKey(agentFile + ".statechart~" + _toString(i));
			StatechartPlans.push_back( StatechartFactory::Instance()->CreateObject( statechart, &com ) );
			LogEntry(LogLevel::ExtraInfo,"Talws")<< statechart;
		}
	}

	//======================= Start Providers  ===================================
	int numOfProviders = Configurator::Instance().numberOfNodesForKey(agentFile + ".provider");
	LogEntry(LogLevel::Info,"Talws") << "Found " <<(numOfProviders) + " providers(s)";

	for (int i=0;i<numOfProviders;i++)
	{
		if(atoi(Configurator::Instance().findValueForKey(agentFile + ".provider~" + _toString(i)+".$Enable").c_str()) == 1){
			std::string provider = Configurator::Instance().findValueForKey(agentFile + ".provider~" + _toString(i));
			KSystem::ThreadConfig tcfg;
			tcfg.IsRealTime = atoi(Configurator::Instance().findValueForKey(agentFile + ".provider~" + _toString(i)+".$IsRealTime").c_str()) == 0 ? false : true;
			tcfg.Priority = atoi(Configurator::Instance().findValueForKey(agentFile + ".provider~" + _toString(i)+".$Priority").c_str());
			float threadFreq = atof(Configurator::Instance().findValueForKey(agentFile + ".provider~" + _toString(i)+".$ThreadFrequency").c_str());
			tcfg.ThreadPeriod = threadFreq > 0 ? 1 / threadFreq  : 0;
			Providers.push_back( ProviderFactory::Instance()->CreateObject(provider ,  tcfg, com ) );
			LogEntry(LogLevel::ExtraInfo,"Talws")<< provider;
		}
	}
}