Exemplo n.º 1
0
//
// Capitalize string, "heLLo" -> "Hello"
//
STR_String& STR_String::Capitalize()
{
	assertd(this->m_data != NULL);
#ifdef WIN32
	if (this->m_len > 0) this->m_data[0] = toupper(this->m_data[0]);
	if (this->m_len > 1) _strlwr(this->m_data + 1);
#else
	if (this->m_len > 0)
		this->m_data[0] = (this->m_data[0] >= 'a' && this->m_data[0] <= 'z') ? this->m_data[0] + 'A' - 'a' : this->m_data[0];
	for (int i = 1; i < this->m_len; i++)
		this->m_data[i] = (this->m_data[i] >= 'A' && this->m_data[i] <= 'Z') ? this->m_data[i] + 'a' - 'A' : this->m_data[i];
#endif
	return *this;
}
Exemplo n.º 2
0
UINT GetWindowsCodePageA(LPCSTR html)
{
	//Changed to make it work
	//There is a problem for non latin users (like me) when downloading
	//English / french / spanish lyrics..
	//To overcome this problem you must check the page's codepage
	//In HTML's 
	//<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> = Latin1 (28591)
	//<meta http-equiv="Content-Type" content="text/html; charset=windows-1253"> = Greek (1253)
	//<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> = Latin1 (1252)
	//<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> = utf8 (65001)
	//If nothing then use Latin1

	UINT codePage = 0;
	LPCSTR startPos = strstr(html, " charset=");
	if (startPos != NULL)
	{
		startPos += 9;
		LPCSTR endPos = strchr(startPos + 1, '"');
		if (endPos != NULL && endPos - startPos < 30)
		{
			CHAR bf[30];
			strncpy(bf, startPos, endPos - startPos);
			bf[endPos - startPos] = 0;
			_strlwr(bf);
			if (_strnicmp(bf, "windows-", 8) == 0 && endPos - startPos > 8)
			{
				codePage = atol(&bf[8]);
			}
			else if (_strnicmp(bf, "iso-8859-", 9) == 0 && endPos - startPos > 9)
			{
				codePage = 28590 +  atol(&bf[9]);
			}
			else if (_strnicmp(bf, "utf-8", 5) == 0)
				codePage = 65001;
			else if (_strnicmp(bf, "utf-7", 5) == 0)
				codePage = 65000;
			else
			{
				TRACE(_T("@1 GetWindowsCodePageA. Unknown charset: '%s'\r\n"), (LPCTSTR)CA2CT(bf));
			}
		}
		else
			TRACE(_T("@1 GetWindowsCodePageA. Can't find END charset\r\n"));
	}
	else
		TRACE(_T("@1 GetWindowsCodePageA. Can't find charset\r\n"));

	return codePage;
}
Exemplo n.º 3
0
static const char* tpss_extract_mod_name_with_ext(const char* full)
{
    const char *slash = NULL;
    char *module_name = NULL;

    if (full)
    {
        slash = strrchr(full, '\\');

        module_name = _strlwr(_strdup(++slash));
    }

    return module_name;
}
Exemplo n.º 4
0
char *
SDL_strlwr(char *string)
{
#if defined(HAVE__STRLWR)
    return _strlwr(string);
#else
    char *bufp = string;
    while (*bufp) {
        *bufp = SDL_tolower((unsigned char) *bufp);
        ++bufp;
    }
    return string;
#endif /* HAVE__STRLWR */
}
Exemplo n.º 5
0
void CN3FXMgr::TriggerBundle(int SourceID, int SourceJoint, int FXID, __Vector3 TargetPos, int idx, int MoveType, unsigned int iVer)
{
	__TABLE_FX* pFX = s_pTbl_FXSource->Find(FXID);
	if(!pFX) return; 

	char buff[MAX_PATH];
	sprintf(buff, pFX->szFN.c_str());
	_strlwr(buff);
	std::string strTmp = buff;

	stlMAP_BUNDLEORIGIN_IT itOrigin = m_OriginBundle.find(strTmp);

	if(itOrigin != m_OriginBundle.end())	//같은 효과가 있다..
	{
		LPFXBUNDLEORIGIN pSrc = itOrigin->second;		
		CN3FXBundleGame* pBundle = new CN3FXBundleGame;
				
		pBundle->SetPreBundlePos(SourceID, SourceJoint);
		pSrc->pBundle->Duplicate(pBundle);
		pBundle->m_iID = FXID;
		pBundle->m_iIdx = idx;
		pBundle->m_iMoveType = MoveType;
		pBundle->m_iSourceJoint = SourceJoint;

		pBundle->Trigger(SourceID, TargetPos, pFX->dwSoundID);		
		m_ListBundle.push_back(pBundle);
		pSrc->iNum++;
	}
	else	//같은 효과가 없다..
	{
		LPFXBUNDLEORIGIN pSrc = new FXBUNDLEORIGIN;
		pSrc->pBundle = new CN3FXBundleGame;
		pSrc->pBundle->LoadFromFile(pFX->szFN, iVer);

		CN3FXBundleGame* pBundle = new CN3FXBundleGame;

		pBundle->SetPreBundlePos(SourceID, SourceJoint);
		pSrc->pBundle->Duplicate(pBundle);	
		pBundle->m_iID = FXID;
		pBundle->m_iIdx = idx;
		pBundle->m_iMoveType = MoveType;
		pBundle->m_iSourceJoint = SourceJoint;

		pBundle->Trigger(SourceID, TargetPos, pFX->dwSoundID);
		m_ListBundle.push_back(pBundle);

		pSrc->iNum++;
		m_OriginBundle.insert(stlMAP_BUNDLEORIGIN_VALUE(strTmp, pSrc));
	}
}
Exemplo n.º 6
0
//
// Capitalize string, "heLLo" -> "Hello"
//
STR_String&	STR_String::Capitalize()
{
	assertd(pData != NULL);
#ifdef WIN32
	if (Len>0) pData[0] = toupper(pData[0]);
	if (Len>1) _strlwr(pData+1);
#else
	if (Len > 0)
		pData[0] = (pData[0] >= 'A' && pData[0] <= 'A')?pData[0]+'a'-'A':pData[0];
	for (int i=1;i<Len;i++)
		pData[i] = (pData[i] >= 'a' && pData[i] <= 'z')?pData[i]+'A'-'a':pData[i];
#endif
	return *this;
}
Exemplo n.º 7
0
void BuildFileList_R( CUtlVector< CUtlSymbol >& files, char const *dir, char const *extension )
{
	WIN32_FIND_DATA wfd;

	char directory[ 256 ];
	char filename[ 256 ];
	HANDLE ff;

	sprintf( directory, "%s\\*.*", dir );

	if ( ( ff = FindFirstFile( directory, &wfd ) ) == INVALID_HANDLE_VALUE )
		return;

	int extlen = strlen( extension );

	do
	{
		if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
		{

			if ( wfd.cFileName[ 0 ] == '.' )
				continue;

			// Recurse down directory
			sprintf( filename, "%s\\%s", dir, wfd.cFileName );
			BuildFileList_R( files, filename, extension );
		}
		else
		{
			int len = strlen( wfd.cFileName );
			if ( len > extlen )
			{
				if ( strstr( wfd.cFileName, ".360." ) )
				{
				}
				else if ( !stricmp( &wfd.cFileName[ len - extlen ], extension ) )
				{
					char filename[ MAX_PATH ];
					Q_snprintf( filename, sizeof( filename ), "%s\\%s", dir, wfd.cFileName );
					_strlwr( filename );

					Q_FixSlashes( filename );

					CUtlSymbol sym = g_Analysis.symbols.AddString( filename );
					files.AddToTail( sym );
				}
			}
		}
	} while ( FindNextFile( ff, &wfd ) );
}
Exemplo n.º 8
0
ST int next_token(struct rootinfo *r)
{
    int s = E_eos;
    _strlwr(NextToken(r->token, &r->cptr, " "));
    r->flag = 1;
    if (r->token[0]) {
        const char * p = r->token;
        if (0 == strncmp(p, "-no", 3))
            r->flag = 0, p+= 3;
        s = get_string_index(p, switches) + E_other + 1;
    }
    //dbg_printf("token %d: %s", s, r->token);
    return s;
}
Exemplo n.º 9
0
bool CloseNTApplication( TCHAR* strApplName, bool bForce /* = false */ )
{
	USES_CONVERSION;

	// Check if application is running
	if (!NTApplicationRunning(strApplName))
		return true;

	// Application is closed
	CInternalData::Instance()->SetApplicationClosed(true);

	// Get the list of process identifiers.
	DWORD aProcesses[1024], cbNeeded, cProcesses;
	unsigned int i;
	std::string strAppName = _strlwr(W2A(strApplName));
	if ( !lpEnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
		return false;

	// Calculate how many process identifiers were returned.
	cProcesses = cbNeeded / sizeof(DWORD);

	// Print the name and process identifier for each process.
	for ( i = 0; i < cProcesses; i++ )
	{
		std::string strProcess = GetProcessNameAndID( aProcesses[i] );

		if( strstr( strProcess.c_str(), strAppName.c_str() ) != NULL )
		{
			// Should we force the application to close?
			if (bForce)
			{
				// Get handle to process
				HANDLE hProcess = OpenProcess
					(PROCESS_ALL_ACCESS, FALSE, aProcesses[i]);

				// Terminate process
				DWORD exCode;
				GetExitCodeProcess(hProcess, &exCode);
				TerminateProcess(hProcess, exCode);
			}
			else
			{
				// Send message to the right window
				EnumWindows(EnumWinHandle, aProcesses[i]);
			}
		}
	}
	return true;
}
Exemplo n.º 10
0
LRESULT CALLBACK DevDetectWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_DEVICECHANGE:
			{
				PDEV_BROADCAST_HDR pBroadcastHdr = (PDEV_BROADCAST_HDR)lParam;
				PDEV_BROADCAST_DEVICEINTERFACE pDevIF = (PDEV_BROADCAST_DEVICEINTERFACE)pBroadcastHdr;

				if(pBroadcastHdr)
				{
					DWORD nEventType = (DWORD)wParam; 
					if (pBroadcastHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) 
					{
						_strlwr(pDevIF->dbcc_name);

						XnUSBEventArgs args;
						args.strDevicePath = pDevIF->dbcc_name;

						switch (nEventType)
						{
						case DBT_DEVICEARRIVAL:
							args.eventType = XN_USB_EVENT_DEVICE_CONNECT;
							break;
						case DBT_DEVICEREMOVECOMPLETE:
							args.eventType = XN_USB_EVENT_DEVICE_DISCONNECT;
							break;
						default:
							return 0;
						}

						for (XnUSBEventCallbackList::Iterator it = g_connectivityEvent.Begin(); it != g_connectivityEvent.End(); ++it)
						{
							XnUSBEventCallback* pCallback = *it;
							if (strstr(args.strDevicePath, pCallback->strVidPid) != NULL)
							{
								pCallback->pFunc(&args, pCallback->pCookie);
							}
						}
					}
				}
			}
			break;
	default:
		return DefWindowProc(hwnd, msg, wParam, lParam);	
	}

	return 0;
}
Exemplo n.º 11
0
bool parse_number(char *lpstrNum, u32 &iNum)
{
   int iRes;

   _strlwr(lpstrNum);
   iRes = sscanf(lpstrNum, "0x%x", &iNum);
   if (EOF == iRes || 0 == iRes)
   {
      iRes = sscanf(lpstrNum, "%u", &iNum);
      if (EOF == iRes || 0 == iRes)
         return false;
   }

   return true;
}
Exemplo n.º 12
0
void MGLTexture::Load(char *name)
{  
	// make the texture name all lower case
	texturename = _strlwr(_strdup(name));

	// strip "'s
	if (strstr(texturename, "\""))
		texturename = strtok(texturename, "\"");

	// check the file extension to see what type of texture
	if(strstr(texturename, ".bmp"))	
		LoadBMP(texturename);
	if(strstr(texturename, ".tga"))	
		LoadTGA(texturename);
}
Exemplo n.º 13
0
bool CNCSProxy::Find() {
	char chName[MAX_PATH];
	string sProxyName = "";
	string sBypassList = "";
        
        if( sm_bUseGlobalProxy ) {
            sm_mProxy.Lock();
            
            m_nProxyPort = sm_nProxyPort;
            m_sProxyName = sm_sProxyName;
            sBypassList = sm_sBypassList;
            
            sm_mProxy.UnLock();
            
            // create bypass list
            CreateBypassList( sBypassList );
            
            return true;
        }
#ifdef WIN32	
	else if(GetModuleFileNameA(NULL, chName, MAX_PATH) &&	_strlwr(chName) && strstr(chName, "netscape.exe") ) { // netscape
		
		if( !GetNetscapeProxyInfo(sProxyName, sBypassList) )
			return false;		
	} else if(GetModuleFileNameA(NULL, chName, MAX_PATH) &&	_strlwr(chName) &&  // direct
		(strstr(chName, "inetinfo.exe") || strstr(chName, "dllhost.exe")  || strstr(chName, "mtx.exe"))) {
		// Running inside IIS
		// use DIRECT!
		return false;
	} else { // ie
		if( !GetIEProxyInfo( sProxyName, sBypassList ) )
			return false;
	}
#elif defined( POSIX )
        else {
            return false;
Exemplo n.º 14
0
CCQuestNPCSetInfo* CCQuestNPCSetCatalogue::GetInfo(const char* szName)
{
	char szLwrName[64];
	strcpy(szLwrName, szName);
	string strName = _strlwr(szLwrName);

	map<string, CCQuestNPCSetInfo*>::iterator itor = m_NameMap.find(strName);
	if (itor != m_NameMap.end())
	{
		return (*itor).second;
	}

	_ASSERT(0);
	return NULL;
}
Exemplo n.º 15
0
static TlenProtocol *tlenProtoInit( const char* pszProtoName, const TCHAR* tszUserName )
{
    DBVARIANT dbv;
    char text[_MAX_PATH];
    TlenProtocol *proto = (TlenProtocol *)mir_alloc(sizeof(TlenProtocol));
    memset(proto, 0, sizeof(TlenProtocol));
    proto->iface.m_tszUserName = mir_tstrdup( tszUserName );
    proto->iface.m_szModuleName = mir_strdup(pszProtoName);
    proto->iface.m_szProtoName = mir_strdup(pszProtoName);
    _strlwr( proto->iface.m_szProtoName );
    proto->iface.m_szProtoName[0] = toupper( proto->iface.m_szProtoName[0] );
    proto->iface.m_iStatus = ID_STATUS_OFFLINE;
    TlenInitServicesVTbl(proto);

    InitializeCriticalSection(&proto->modeMsgMutex);
    InitializeCriticalSection(&proto->csSend);

    sprintf(text, "%s/%s", proto->iface.m_szModuleName, "Nudge");
    proto->hTlenNudge = CreateHookableEvent(text);

    HookEventObj_Ex(ME_SYSTEM_MODULESLOADED, proto, TlenSystemModulesLoaded);
    HookEventObj_Ex(ME_OPT_INITIALISE, proto, TlenOptionsInit);
    HookEventObj_Ex(ME_DB_CONTACT_SETTINGCHANGED, proto, JabberDbSettingChanged);
    HookEventObj_Ex(ME_DB_CONTACT_DELETED, proto, JabberContactDeleted);
    HookEventObj_Ex(ME_CLIST_PREBUILDCONTACTMENU, proto, TlenPrebuildContactMenu);
//	HookEventObj_Ex(ME_SKIN2_ICONSCHANGED, proto, TlenIconsChanged);
    HookEventObj_Ex(ME_SYSTEM_PRESHUTDOWN, proto, TlenPreShutdown);

    if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "LoginServer", &dbv)) {
        DBFreeVariant(&dbv);
    } else {
        DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "LoginServer", "tlen.pl");
    }
    if (!DBGetContactSetting(NULL, proto->iface.m_szModuleName, "ManualHost", &dbv)) {
        DBFreeVariant(&dbv);
    } else {
        DBWriteContactSettingString(NULL, proto->iface.m_szModuleName, "ManualHost", "s1.tlen.pl");
    }

    TlenLoadOptions(proto);

    JabberWsInit(proto);
    JabberSerialInit(proto);
    JabberIqInit(proto);
    JabberListInit(proto);

    return proto;
}
Exemplo n.º 16
0
DBOOL CameraObj::InitialUpdate()
{
	DBYTE nFlags;
	char szWorldName[_MAX_PATH];

	if (!g_pServerDE) return DFALSE;

	SetActive(m_bStartActive);

	// Tell clients about the camera...
	HMESSAGEWRITE hMessage = g_pServerDE->StartSpecialEffectMessage(this);
	g_pServerDE->WriteToMessageByte(hMessage, SFX_CAMERA_ID);
	g_pServerDE->WriteToMessageByte(hMessage, m_nType);
	nFlags = 0;
	if( m_bPlayerMovement )
		nFlags |= CAMERASFXFLAG_ALLOWPLAYERMOVEMENT;
	if( m_bHidePlayer )
		nFlags |= CAMERASFXFLAG_HIDEPLAYER;
	if( m_bIsListener )
	{
		nFlags |= CAMERASFXFLAG_ISLISTENER;

		// The b2 1.0 worlds were designed around a bug with the camera that did not pass the islistener
		// flag down.  So this hack prevents the islistener flag for those levels.
		if( g_szVarWorldName )
		{
			HCONVAR hTempVar = g_pServerDE->GetGameConVar(g_szVarWorldName);
			if (hTempVar)
			{
				char* sTempString = g_pServerDE->GetVarValueString(hTempVar);
				if (sTempString)
				{
					SAFE_STRCPY( szWorldName, sTempString);
					_strlwr( szWorldName );
					if( strstr( szWorldName, "worlds\\" ))
						nFlags &= ~CAMERASFXFLAG_ISLISTENER;
				}
			}
		}
	}
	g_pServerDE->WriteToMessageByte( hMessage, nFlags );
	g_pServerDE->EndMessage(hMessage);

	DDWORD dwUsrFlags = g_pServerDE->GetObjectUserFlags(m_hObject);
	g_pServerDE->SetObjectUserFlags(m_hObject, dwUsrFlags | USRFLG_SAVEABLE);

	return DTRUE;
}
Exemplo n.º 17
0
ATOM_AUTOREF(ATOM_SharedModel) ATOM_Components::findModel (const char *filename)
{
	ATOM_STACK_TRACE(ATOM_Components::findModel);
	if (filename)
	{
		char buffer[ATOM_VFS::max_filename_length];
		if (!ATOM_CompletePath (filename, buffer))
		{
			return false;
		}
		_strlwr (buffer);

		return ATOM_LookupObject (ATOM_SharedModel::_classname(), buffer);
	}
	return 0;
}
Exemplo n.º 18
0
// Service function, adds valid memory adress in MASM or Ideal format to
// disassembled string. Parameters: defseg - default segment for given
// register combination, descr - fully decoded register part of address,
// offset - constant part of address, dsize - data size in bytes. If global
// flag 'symbolic' is set, function also tries to decode offset as name of
// some label.
static void Memadr(int defseg,const char *descr,long offset,int dsize) {
  int i,n,seg;
  char *pr;
  char s[TEXTLEN];
  if (mode<DISASM_FILE || descr==NULL)
    return;                            // No need or possibility to decode
  pr=da->result+nresult; n=0;
  if (segprefix!=SEG_UNDEF) seg=segprefix; else seg=defseg;
  if (ideal!=0) pr[n++]='[';
  // In some cases Disassembler may omit size of memory operand. Namely, flag
  // showmemsize must be 0, type bit C_EXPL must be 0 (this bit namely means
  // that explicit operand size is necessary) and type of command must not be
  // C_MMX or C_NOW (because bit C_EXPL has in these cases different meaning).
  // Otherwise, exact size must be supplied.
  if (showmemsize!=0 || (da->cmdtype & C_TYPEMASK)==C_MMX ||
    (da->cmdtype & C_TYPEMASK)==C_NOW || (da->cmdtype & C_EXPL)!=0
  ) {
    if (dsize<sizeof(sizename)/sizeof(sizename[0]))
      n+=sprintf(pr+n,"%s %s",sizename[dsize],(ideal==0?"PTR ":""));
    else
      n+=sprintf(pr+n,"(%i-BYTE) %s",dsize,(ideal==0?"PTR ":""));
    ;
  };
  if ((putdefseg!=0 || seg!=defseg) && seg!=SEG_UNDEF)
    n+=sprintf(pr+n,"%s:",segname[seg]);
  if (ideal==0) pr[n++]='[';
  n+=sprintf(pr+n,"%s",descr);
  if (lowercase) _strlwr(pr);
  if (offset==0L) {
    if (*descr=='\0') pr[n++]='0'; }
  else {
    if (symbolic && mode>=DISASM_CODE)
      i=Decodeaddress(offset,s,TEXTLEN-n-24,NULL);
    else i=0;
    if (i>0) {                         // Offset decoded in symbolic form
      if (*descr!='\0') pr[n++]='+';
      strcpy(pr+n,s); n+=i; }
    else if (offset<0 && offset>-16384 && *descr!='\0')
      n+=sprintf(pr+n,"-%lX",-offset);
    else {
      if (*descr!='\0') pr[n++]='+';
      n+=sprintf(pr+n,"%lX",offset);
    };
  };
  pr[n++]=']'; pr[n]='\0';
  nresult+=n;
};
Exemplo n.º 19
0
int ProfanityFilter::FilterProfanity(const char *input, char *output, bool filter)
{
	int count = 0;
	char* b = (char *) alloca(strlen(input) + 1); 
	strcpy(b, input);
	_strlwr(b);
	char *start = b;
	if (output)
		strcpy(output,input);

	start = strpbrk(start, WORDCHARS);
	while (start != 0)
	{
		size_t len = strspn(start, WORDCHARS);
		if (len > 0)
		{
			// we a have a word - let's check if it's a BAAAD one
			char saveChar = start[len];
			start[len] = '\0';

			// loop through profanity list			
			for (unsigned int i = 0, size = words.Size(); i < size; i++)
			{
				if (_stricmp(start, words[i].C_String()) == 0)
				{
					count++;

					// size_t len = words[i].size();
					if (filter && output)
					{
						for (unsigned int j = 0; j < len; j++)
						{
							output[start + j - b] = RandomBanChar();
						}
					}
					break;
				}				
			}
			start[len] = saveChar;
		}

		start += len;
		start = strpbrk(start, WORDCHARS);
	}

	return count;
}
Exemplo n.º 20
0
void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, const CMString &defaultFile)
{
	char *proto = GetContactProto(hContact);
	if (proto == NULL)
		return;

	DBVARIANT dbv;
	if (!db_get_ts(hContact, proto, "Transport", &dbv)) {
		if (dbv.ptszVal[0] == '\0') {
			db_free(&dbv);
			return;
		}
		char *trsp = mir_strdup(_T2A(dbv.ptszVal));
		_strlwr(trsp);

		const char *packname = NULL;
		if (strstr(trsp, "msn") != NULL)
			packname = "msn";
		else if (strstr(trsp, "icq") != NULL)
			packname = "icq";
		else if (strstr(trsp, "yahoo") != NULL)
			packname = "yahoo";
		else if (strstr(trsp, "aim") != NULL)
			packname = "aim";
		else if (strstr(trsp, "lcs") != NULL)
			packname = "msn";

		mir_free(trsp);

		CMString displayName = dbv.ptszVal;
		if (packname != NULL) {
			char path[MAX_PATH];
			mir_snprintf(path, "Smileys\\nova\\%s.msl", packname);

			CMString paths = _A2T(path), patha;
			pathToAbsolute(paths, patha);

			if (_taccess(patha.c_str(), 0) != 0)
				paths = defaultFile;

			AddCategory(displayName, displayName, smcTransportProto, paths);
		}
		else AddCategory(displayName, displayName, smcTransportProto, defaultFile);

		db_free(&dbv);
	}
}
Exemplo n.º 21
0
JABBER_LIST_ITEM *JabberListAdd(JABBER_LIST list, const char *jid)
{
	char *s, *p, *q;
	JABBER_LIST_ITEM *item;

	EnterCriticalSection(&csLists);
	if ((item=JabberListGetItemPtr(list, jid)) != NULL) {
		LeaveCriticalSection(&csLists);
		return item;
	}

	s = mir_strdup(jid); _strlwr(s);
	// strip resource name if any
	if ((p=strchr(s, '@')) != NULL) {
		if ((q=strchr(p, '/')) != NULL)
			*q = '\0';
	}

	lists = (JABBER_LIST_ITEM *) mir_realloc(lists, sizeof(JABBER_LIST_ITEM)*(count+1));
	item = &(lists[count]);
	memset(item, 0, sizeof(JABBER_LIST_ITEM));
	item->list = list;
	item->jid = s;
	item->nick = NULL;
	item->status = ID_STATUS_OFFLINE;
	item->statusMessage = NULL;
	item->group = NULL;
	item->messageEventIdStr = NULL;
	item->wantComposingEvent = FALSE;
	item->isTyping = FALSE;
//	item->type = NULL;
	item->ft = NULL;
	item->roomName = NULL;
	item->version = NULL;
	item->software = NULL;
	item->system = NULL;
	item->avatarHash = NULL;
	item->avatarFormat = PA_FORMAT_UNKNOWN;
	item->newAvatarDownloading = FALSE;
	item->versionRequested = FALSE;
	item->infoRequested = FALSE;
	count++;
	LeaveCriticalSection(&csLists);

	return item;
}
Exemplo n.º 22
0
void http::skip_application::do_action(http::request_message& msg)
{
	message_headers const& hdrs = msg.headers();
	//! провер¤ем, что это не запрос от winamp-a
	http::buffer_t fld(&winamp_fld[0], sizeof(winamp_fld) - 1);
	http::vector_ptr val = hdrs.get(fld);
	skipped_ = val.get() != 0;
	//! провер¤ем, что запрос не есть тунелированное потоковое видиео
	//! Real Time Streaming Protocol (RTSP) RFC2326
	if(!skipped_)
	{
		vector_ptr const& subtype = msg.media_subtype();
		char *media_sub_type = _strlwr(&(*subtype)[0]);
		skipped_ = (_stricmp(media_sub_type, qtplayer_stream) == 0 ||
					_stricmp(media_sub_type, vvtk_tunnel) == 0);
	}
}
Exemplo n.º 23
0
char* dStrlwr(char *str)
{
#if defined(TORQUE_OS_WIN) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
   return _strlwr(str);
#else
   if (str == NULL)
      return(NULL);

   char* saveStr = str;
   while (*str)
   {
      *str = tolower(*str);
      str++;
   }
   return saveStr;
#endif
}
Exemplo n.º 24
0
void ZChatCmdManager::AddAlias(const char* szNewCmdName, const char* szTarCmdName)
{
/*
	ZChatCmd* pCmd = GetCommandByName(szTarCmdName);
	if (pCmd == NULL)
	{
		_ASSERT(0);		// 앨리어스 대상 커맨드가 존재하지 않음
		return;
	}
*/

	char szLwrName[256];
	strcpy(szLwrName, szNewCmdName);
	_strlwr(szLwrName);

	m_AliasMap.insert(map<std::string, std::string>::value_type(std::string(szLwrName), std::string(szTarCmdName)));
}
Exemplo n.º 25
0
int asm_cmd_in(FILE* strin, double* codes, int* cur_code)
{
	if (strin == NULL) return ASM_STRIN_BAD;
	if (codes == NULL) return ASM_BAD_CODES_POINTER;
	if (cur_code == NULL) return ASM_BAD_CUR_CODE_POINTER;

	char in_word[CMD_MAXLEN] = {};
	int cond = fscanf_s(strin, "%s", in_word, CMD_MAXLEN);
	if (cond <= 0) return ASM_SCAN_FAILED;
		
	double reg = 0;
	int ret = asm_str_convert(_strlwr(in_word), &reg);
	if (ret != ASM_OK) return ASM_BAD_IN_STR_TOKEN;

	SEC_RUN_(asm_push_code(codes, cur_code, reg));
	return ASM_OK;
}
Exemplo n.º 26
0
SymTableNodePtr ABLModule::findFunction(PSTR functionName, bool searchLibraries)
{
    SymTableNodePtr symbol = searchSymTableForFunction(functionName, ModuleRegistry[handle].moduleIdPtr->defn.info.routine.localSymTable);
    if(!symbol && searchLibraries)
    {
        for(size_t i = 0; i < ModuleRegistry[handle].numLibrariesUsed; i++)
        {
            char temp[1024];
            memset(temp, 0, 1024);
            strncpy(temp, functionName, (strlen(functionName) > 1020) ? 1020 : strlen(functionName));
            symbol = searchSymTable(_strlwr(temp), ModuleRegistry[ModuleRegistry[handle].librariesUsed[i]->handle].moduleIdPtr->defn.info.routine.localSymTable);
            if(symbol)
                break;
        }
    }
    return(symbol);
}
Exemplo n.º 27
0
bool GetModelNameFromSourceFile( char const *filename, char *modelname, int maxlen )
{
	modelname[0]=0;

	int filelength;
	char *buffer = (char *)COM_LoadFile( filename, &filelength );
	if ( !buffer )
	{
		vprint( 0, "Couldn't load %s\n", filename );
		return false;
	}

	bool valid = false;

	// Parse tokens
	char *current = buffer;
	while ( current )
	{
		current = CC_ParseToken( current );
		if ( strlen( com_token ) <= 0 )
			break;

		if ( stricmp( com_token, "$modelname" ) )
			continue;

		current = CC_ParseToken( current );

		strcpy( modelname, com_token );
		_strlwr( modelname );

		Q_FixSlashes( modelname );

		Q_DefaultExtension( modelname, ".mdl", maxlen );

		valid = true;
		break;
	}

	COM_FreeFile( (unsigned char *)buffer );

	if ( !valid )
	{
		vprint( 0, ".qc file %s missing $modelname directive!!!\n", filename );
	}
	return valid;
}
Exemplo n.º 28
0
void JabberDBAddAuthRequest(char *jid, char *nick)
{
	char *s, *p, *q;
	DBEVENTINFO dbei = {0};
	PBYTE pCurBlob;
	HANDLE hContact;

	// strip resource if present
	s = mir_strdup(jid);
	if ((p=strchr(s, '@')) != NULL) {
		if ((q=strchr(p, '/')) != NULL)
			*q = '\0';
	}
	_strlwr(s);

	if ((hContact=JabberHContactFromJID(jid)) == NULL) {
		hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
		CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) jabberProtoName);
		DBWriteContactSettingString(hContact, jabberProtoName, "jid", s);
	}
	else {
		DBDeleteContactSetting(hContact, jabberProtoName, "Hidden");
	}
	DBWriteContactSettingString(hContact, jabberProtoName, "Nick", nick);

	//blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
	//blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
	dbei.cbSize = sizeof(DBEVENTINFO);
	dbei.szModule = jabberProtoName;
	dbei.timestamp = (DWORD) time(NULL);
	dbei.flags = 0;
	dbei.eventType = EVENTTYPE_AUTHREQUEST;
	dbei.cbBlob = sizeof(DWORD) + sizeof(HANDLE) + strlen(nick) + strlen(jid) + 5;
	pCurBlob = dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob);
	*((PDWORD) pCurBlob) = 0; pCurBlob += sizeof(DWORD);
	*((PHANDLE) pCurBlob) = hContact; pCurBlob += sizeof(HANDLE);
	strcpy((char *) pCurBlob, nick); pCurBlob += strlen(nick)+1;
	*pCurBlob = '\0'; pCurBlob++;		//firstName
	*pCurBlob = '\0'; pCurBlob++;		//lastName
	strcpy((char *) pCurBlob, jid); pCurBlob += strlen(jid)+1;
	*pCurBlob = '\0';					//reason

	CallService(MS_DB_EVENT_ADD, (WPARAM) (HANDLE) NULL, (LPARAM) &dbei);
	JabberLog("Setup DBAUTHREQUEST with nick='%s' jid='%s'", nick, jid);
}
Exemplo n.º 29
0
int Evaluate( CMCPforNTDoc* pDoc,char* e, double* result, int* a, USHORT ind )
{
   EVALUATENEXT = FALSE;
   double inde = ind;
   SetValue("i",&inde);
   pDocument = pDoc;
   index = ind;
   if( setjmp( jb ) ) 
	   return( ERRORNUM );
   expression = (char*)e;
   ERANC = e;
   _strlwr(expression );
   *result = 0;
   Parse();
   if( ! *token ) ERR( E_EMPTY );
   *a = Level1( result );
   return( E_OK );
}
Exemplo n.º 30
0
// assuming all args are appended to any args that the UL expects, so decrement __argc by 1 if the specific arg we are looking for is found
bool CIniFileProcessor::ExtractFlags(LPTSTR m_lpCmdLine)
{
	// looking for debug flag only
	TCHAR foo[512];
	strcpy(foo, m_lpCmdLine);
	_strlwr(foo);
	char* c = strstr(foo, "/demo");
	if (c != NULL)
	{
		int index = foo - c;
		CIniFileProcessor::SaveSingleValue(eDEMOVERSION,"yes");
		for (int i = 0; i < 5; i++)
			m_lpCmdLine[index+i] = ' ';
		__argc--;
	}
	return true;

}