Example #1
0
void ConsolePrintWarning(MSGVEC *msgvecP)
{
  TCHAR format[80];
  TCHAR *msgtextP;

  // Print the primary warning message.

  msgtextP = GetMessageText(msgvecP->code);

  StrPrintf (format, msgtextP,
    msgvecP->param[0], msgvecP->param[1], msgvecP->param[2],
    msgvecP->param[3], msgvecP->param[4], msgvecP->param[5],
    msgvecP->param[6], msgvecP->param[7]);

  FPrintf (stderr, _T("\nWarning: %s\n"), format);

  // Print the (optional) secondary warning message.

  if (msgvecP->subcode)
    {
    msgtextP = GetMessageText(msgvecP->subcode);

    StrPrintf (format, msgtextP,
      msgvecP->subparam[0], msgvecP->subparam[1], msgvecP->subparam[2],
      msgvecP->subparam[3], msgvecP->subparam[4], msgvecP->subparam[5],
      msgvecP->subparam[6], msgvecP->subparam[7]);

    FPrintf (stderr, _T("%s\n"), format);
    }
}
Example #2
0
static int MsgEventAdded(WPARAM wParam,LPARAM lParam)
{
	HANDLE hDbEvent = (HANDLE)lParam;

	if (currentWatcherType & SDWTF_MESSAGE) {
		DBEVENTINFO dbe = { sizeof(dbe) };
		dbe.cbBlob = db_event_getBlobSize(hDbEvent);
		dbe.pBlob = (BYTE*)mir_alloc(dbe.cbBlob+2); /* ensure term zero */
		if (dbe.pBlob == NULL)
			return 0;
		if (!db_event_get(hDbEvent, &dbe))
			if (dbe.eventType == EVENTTYPE_MESSAGE && !(dbe.flags & DBEF_SENT)) {
				DBVARIANT dbv;
				if (!db_get_ts(NULL,"AutoShutdown","Message",&dbv)) {
					TrimString(dbv.ptszVal);
					TCHAR *pszMsg = GetMessageText(&dbe.pBlob,&dbe.cbBlob);
					if (pszMsg != NULL && _tcsstr(pszMsg,dbv.ptszVal) != NULL)
						ShutdownAndStopWatcher(); /* msg with specified text recvd */
					mir_free(dbv.ptszVal); /* does NULL check */
				}
			}
		mir_free(dbe.pBlob);
	}
	return 0;
}
Example #3
0
//*****************************************************************************
const WCHAR * CDbMessageText::operator = (
//Assign a new string.
//
//Params:
	const CDbMessageText &text) //(in)  Make copy of this text.
{
	WCHAR const* pwczText = NULL;
	if (text.bIsLoaded)
	{
		pwczText = (const WCHAR*)text;
		this->bIsDirty = true;
	} else if (text.eMessageID != UNBOUND_MESSAGE) {
		const Language::LANGUAGE curLanguage = Language::GetLanguage();
		if (this->bUseDefaultLanguage)
			Language::SetLanguage(Language::English);
		pwczText = GetMessageText(text.eMessageID);
		Language::SetLanguage(curLanguage);

		//If this text is already bound to the same ID as 'text' has,
		//then retrieve the text but don't set the dirty bit on this object.
		//Otherwise, we'd be resaving an unchanged text to the DB on UpdateText.
		this->bIsDirty = text.eMessageID != this->eMessageID;
	}

	this->wstrText = pwczText ? pwczText : wszEmpty;
	this->bIsLoaded = true; //In other words, if we weren't loaded before, it
	                        //doesn't matter now, because new value will overwrite.
	return this->wstrText.size() ? this->wstrText.c_str() : wszEmpty;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CDemoActionTextMessageStart::FireAction( void )
{
	GetTextMessage()->pVGuiSchemeFontName = GetFontName();

	TextMessage_DemoMessageFull( GetMessageText(), GetTextMessage() );
	CL_HudMessage( (const char *)DEMO_MESSAGE );
	SetFinishedAction( true );
}
Example #5
0
LPCSTR CPop3Message::GetRawBody() const
{
	char* pszStartBody = strstr(GetMessageText(), "\r\n\r\n");
	if (pszStartBody == NULL) 
		return NULL;
	else 
		return pszStartBody + 4;
}
Example #6
0
//*****************************************************************************
CDbMessageText::operator const WCHAR *()
//Returns const string, loading from database if needed.
{
	if (!this->bIsLoaded && this->eMessageID != UNBOUND_MESSAGE)
	{
		const WCHAR *pwczText = GetMessageText(this->eMessageID);
		this->wstrText = (pwczText != NULL) ? pwczText : wszEmpty;
		ASSERT(pwczText); //Probably bad binding if fires.
		this->bIsLoaded = true;
	}
	return (this->wstrText.size()) ? this->wstrText.c_str() : wszEmpty;
}
Example #7
0
//*****************************************************************************
const WCHAR * CDbMessageText::operator = (
//Assign a new string.
//
//Params:
	const CDbMessageText &text) //(in)	Make copy of this text.
{
	WCHAR const* pwczText = NULL;
   if (text.bIsLoaded)
	   pwczText = (const WCHAR*)text;
   else if (text.eMessageID != UNBOUND_MESSAGE)
	   pwczText = GetMessageText(text.eMessageID);

	return *this = pwczText;
}
Example #8
0
//*****************************************************************************
void CDbMessageText::Load()
//Loads text string from the DB, if needed.
{
	if (!this->bIsLoaded && this->eMessageID != UNBOUND_MESSAGE)
	{
		const Language::LANGUAGE curLanguage = Language::GetLanguage();
		if (this->bUseDefaultLanguage)
			Language::SetLanguage(Language::English);
		const WCHAR *pwczText = GetMessageText(this->eMessageID);
		Language::SetLanguage(curLanguage);

		this->wstrText = (pwczText != NULL) ? pwczText : wszEmpty;
		ASSERT(pwczText); //Probably bad binding if fires.
		this->bIsLoaded = true;
	}
}
Example #9
0
std::string LSBSoundCoder::GetMessage( const Container* _container, const Key* _key )
{
    // Must be a BMP container
    if ( _container->IsWaveContainer() )
    {
        // Get container
        const WAVContainer* container = 
            static_cast<const WAVContainer*>(_container);

        // Setup Wave container
        SetupContainer(container);

        // Get message length first
        unsigned long messageLength = GetMessageLength();

        // Get message text
        return GetMessageText(messageLength);
    }

    // Error, not a Wave container
    return "";
}
Example #10
0
//*****************************************************************************
const WCHAR * CDbMessageText::operator += (
//Append a string to end.
//
//Params:
	const WCHAR * wczSet) //(in)	String to append to current.
//
//Returns:
//Const pointer to string.
{
	if (!this->bIsLoaded && this->eMessageID != UNBOUND_MESSAGE)
	{
		const WCHAR *pwczText = GetMessageText(this->eMessageID);
		this->wstrText = (pwczText != NULL) ? pwczText : wszEmpty;
		ASSERT(pwczText); //Probably bad binding if fires.
		this->bIsLoaded = true;
	}

	this->wstrText += wczSet;
	this->bIsDirty = true;

	return (this->wstrText.size()) ? this->wstrText.c_str() : wszEmpty;
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : buf - 
//-----------------------------------------------------------------------------
void CDemoActionTextMessageStart::SaveKeysToBuffer( int depth, CUtlBuffer& buf )
{
	BaseClass::SaveKeysToBuffer( depth, buf );

	client_textmessage_t const *tm = GetTextMessage();

	int fadeinout = tm->effect == 0 ? 1 : 0;
	int fadeinoutflicker = tm->effect == 1 ? 1 : 0;
	int fadewriteout  = tm->effect == 2 ? 1 : 0;

	BufPrintf( depth, buf, "message \"%s\"\n", GetMessageText() );
	BufPrintf( depth, buf, "font \"%s\"\n", GetFontName() );

	BufPrintf( depth, buf, "fadein \"%.3f\"\n", tm->fadein );
	BufPrintf( depth, buf, "fadeout \"%.3f\"\n", tm->fadeout );
	BufPrintf( depth, buf, "holdtime \"%.3f\"\n", tm->holdtime );
	BufPrintf( depth, buf, "fxtime \"%.3f\"\n", tm->fxtime );

	if ( fadeinout > 0 ) BufPrintf( depth, buf, "FADEINOUT \"1\"\n" );
	if ( fadeinoutflicker > 0 ) BufPrintf( depth, buf, "FLICKER \"1\"\n" );
	if ( fadewriteout > 0 ) BufPrintf( depth, buf, "WRITEOUT \"1\"\n" );

	BufPrintf( depth, buf, "x \"%f\"\n", tm->x );
	BufPrintf( depth, buf, "y \"%f\"\n", tm->y );

	BufPrintf( depth, buf, "r1 \"%i\"\n", tm->r1 );
	BufPrintf( depth, buf, "g1 \"%i\"\n", tm->g1 );
	BufPrintf( depth, buf, "b1 \"%i\"\n", tm->b1 );
	BufPrintf( depth, buf, "a1 \"%i\"\n", tm->a1 );

	BufPrintf( depth, buf, "r2 \"%i\"\n", tm->r2 );
	BufPrintf( depth, buf, "g2 \"%i\"\n", tm->g2 );
	BufPrintf( depth, buf, "b2 \"%i\"\n", tm->b2 );
	BufPrintf( depth, buf, "a2 \"%i\"\n", tm->a2 );

}
Example #12
0
//*****************************************************************************
void CDbMessageText::ExportText(CStretchyBuffer& buf, const char* pTagName)
//Outputs message (language) texts for this message ID as XML tags.
{
	ASSERT(pTagName);

	const Language::LANGUAGE eLanguage = Language::GetLanguage();
	CCoordSet ids(GetMessageTextIDs(this->eMessageID));
	bool bActiveLanguageFound = false;
	for (CCoordSet::const_iterator id = ids.begin(); id != ids.end(); ++id)
	{
		//Append XML fields for each message text for this messageID.
		const UINT wLanguageIndex = id->wY;
		if (!wLanguageIndex || wLanguageIndex >= Language::LanguageCount)
			continue; //not a valid language ID -- skip it

		buf += "<";
		buf += pTagName;

		if (eLanguage == wLanguageIndex)
			bActiveLanguageFound = true;
		buf += " lang='";
		buf += Language::GetCode(wLanguageIndex);

		BYTE* pbOutStr = NULL;
		c4_Bytes MessageTextBytes = p_MessageText(GetRowRef(V_MessageTexts, id->wX));
		const WCHAR *pText = GetMessageText(MessageTextBytes);
		const UINT wSize = to_utf8(pText, pbOutStr);
		buf += "' text=\"";
		if (wSize)
		{
			//Replace characters that are illegal in XML strings with entities.
			string outstr;
			for (UINT wIndex = 0; wIndex < wSize; ++wIndex)
				switch (pbOutStr[wIndex])
				{
					case 10:  outstr += "&#10;"; break;
					case 13:  outstr += "&#13;"; break;
					case '"': outstr += "&quot;"; break;
					case '<': outstr += "&lt;"; break;
					case '>': outstr += "&gt;"; break;
					case '&': outstr += "&amp;"; break;
					case '\'': //allow apostrophes in text
					default: outstr += pbOutStr[wIndex]; break;
				}
			buf.Append((const BYTE*)outstr.c_str(), outstr.size());
		}
		delete[] pbOutStr;

		buf += "\"/>" NEWLINE;
	}

	//Add an empty language tag for the active language when texts for other
	//languages, but not this one, are found.
	if (!bActiveLanguageFound && !ids.empty())
	{
		buf += "<";
		buf += pTagName;
		buf += " lang='";
		buf += Language::GetCode(eLanguage);
		buf += "' text=\"\"/>" NEWLINE;
	}
}